// Force WooCommerce to believe that the downloadable file exists add_filter( ‘woocommerce_downloadable_file_exists’, ‘__return_true’ ); // Intercept the downloadable file as it is being returned to the customer and return something else function custom_override_product_file_download_path( $file_path, $object, $download_id ) { // Fetch…Continue reading
// Clear the Akismet logs hourly function custom_akismet_schedule_hourly_cron() { // Use wp_next_scheduled to check if the event is already scheduled $timestamp = wp_next_scheduled( ‘custom_akismet_hourly_cron’ ); //If $timestamp == false schedule daily backups since it hasn’t been done previously if( $timestamp…Continue reading
// Conditionally display a persistent notice on the My Account screen function custom_woocommerce_before_my_account() { // Get all the Orders associated with this User $args = array( ‘numberposts’ => -1, ‘meta_key’ => ‘_customer_user’, ‘meta_value’ => get_current_user_id(), ‘post_type’ => wc_get_order_types(), ‘post_status’ =>…Continue reading
// Conditionally display a persistent notice on the Single Product screen function custom_woocommerce_before_main_content() { // Check that we are on the Single Product screen if( !is_product() ) return; // Check if the referrer is available if( !isset( $_SERVER[‘HTTP_REFERER’] ) )…Continue reading
function custom_woo_ce_extend_user_fields( $fields = array() ) { $fields[] = array( ‘name’ => ‘user_tag’, ‘label’ => __( ‘User Tag’, ‘woocommerce-exporter’ ), ‘hover’ => __( ‘Custom User field within functions.php’ ) ); return $fields; } add_filter( ‘woo_ce_user_fields’, ‘custom_woo_ce_extend_user_fields’ ); function custom_woo_ce_user_extend( $user…Continue reading
function custom_woo_ce_orders_filter_by_custom_meta() { // This is the Order meta key we want to filter Orders by $meta_key = ‘_shipping_postcode’; ob_start(); ?>Continue reading
function custom_woo_ce_scheduled_export_products_filter_by_custom_meta( $post_ID = 0 ) { // This is the Product meta key we want to filter Products by $meta_key = ‘performance_date’; $custom_meta = get_post_meta( $post_ID, ‘_filter_product_custom_meta’, true ); ob_start(); ?>Continue reading
function custom_woo_pd_get_filename_dynamic_filename( $output, $filename ) { // Check we are dealing with https://images.sample-domain.com/is/image/dynamic/products/… if( strpos( $filename, ‘images.sample-domain.com/is/image/dynamic/products’ ) !== false ) { $output = basename( $filename ); // Strip the filename down to the ? character $pos = strpos( $output,…Continue reading
function custom_woo_pd_get_filename_dynamic_filename( $output, $filename ) { // Check we are dealing with https://images.sample-domain.com/is/image/dynamic/products/… if( strpos( $filename, ‘images.sample-domain.com/is/image/dynamic/products’ ) !== false ) { $output = basename( $filename ); // Strip the filename down to the ? character $pos = strpos( $output,…Continue reading
function custom_woo_ce_order_items_individual_output( $output, $order, $order_item ) { if( !empty( $order->order_items ) ) { // Check the Order Item has a Product ID if( !empty( $order_item->product_id ) ) { // Multiply the Order Item by the Quantity value if( !empty( $order_item->quantity…Continue reading