• Resolved JapeNZ

    (@japenz)


    Hi there,
    I have the following snippet applied to help speed up the Woocommerce checkout when a large number of products are ordered:

    add_filter( 'woocommerce_defer_transactional_emails', '__return_true' );

    Unfortuately this also seems to force customer and admin order emails when I split an order, even with ‘Disable order email’ set for everyone.
    Is there any workaround I can use that will stop the order split emails being sent do you think?

    Thank you for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter JapeNZ

    (@japenz)

    Would it be possible to add a function that disables the ‘woocommerce_defer_transactional_emails’ filter during the order split, then enables it once the split is complete do you think?

    • This reply was modified 5 months, 3 weeks ago by JapeNZ.
    Plugin Author YoOhw Studio

    (@yoohw)

    Sorry for the very late reply, we did miss your thread.

    I got your problem, we will add the function in the next version to fix it for the users who use the filter:

    add_filter( 'woocommerce_defer_transactional_emails', '__return_true' );

    In the mean time, you can add this code in the functions.php (Child theme) to make the order emails work correctly:

    function set_email_filters() {
    $email_setting = get_option('new_order_email_option', 'none');
    switch ($email_setting) {
    case 'for_customers':
    add_filter('woocommerce_email_recipient_customer_on_hold_order', '__return_empty_string');
    add_filter('woocommerce_email_recipient_customer_processing_order', '__return_empty_string');
    break;
    case 'for_administrators':
    add_filter('woocommerce_email_recipient_new_order', '__return_empty_string');
    break;
    case 'for_everyone':
    add_filter('woocommerce_email_recipient_customer_on_hold_order', '__return_empty_string');
    add_filter('woocommerce_email_recipient_customer_processing_order', '__return_empty_string');
    add_filter('woocommerce_email_recipient_new_order', '__return_empty_string');
    break;
    }
    }
    add_action('init', 'set_email_filters');

    Let me know if it works or need any assist.

    • This reply was modified 5 months, 2 weeks ago by YoOhw Studio.
    • This reply was modified 5 months, 2 weeks ago by YoOhw Studio.
    Thread Starter JapeNZ

    (@japenz)

    Hi @yoohw,

    Amazing work, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.