custom trigger

Forums Custom Emails for WooCommerce custom trigger

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #130519
    Moshtafizur
    Participant

    Hi there,

    I have escalated this with our development team. They will let you know if it would be possible.

    Kind regards.

    #130593
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    Please try this:

    Select “Subscriptions: Subscription status updated to” in “Enabled triggers groups” in “WooCommerce > Settings > Custom Emails > General > Advanced Options”.

    Then go to “WooCommerce > Settings > Emails > Custom email”, set “Triggers” to “Subscription status updated to On Hold”, and “Delay” to “1 hour”.

    Now, to ensure that the email is sent only if the subscription is still “on hold”, we need to add this snippet:

    add_filter( 'alg_wc_custom_emails_do_send_order_email', function ( $do_send, $email, $order ) {
        return $order->has_status( 'on-hold' );
    }, 10, 3 );

    Please give it a try and let me know what you think.

    #130894
    september18.nl
    Participant

    where should i add the snippet, just in theme functions file?

    #130895
    september18.nl
    Participant

    is the filter function applied to every mail thats using “Subscription status updated to On Hold” or every “Subscription status updated to”.

    is it posible to also connect the filter to one specific mail? so apply only the filter to alg_wc_custom_email_4 and not to 3,2 and 1

    #131194
    Tom Anbinder
    Moderator
    Plugin Support

    Hi,

    where should i add the snippet, just in theme functions file?

    Yes, you can put it in your child theme’s functions.php file.

    is it posible to also connect the filter to one specific mail?

    Yes, you can use the $email->alg_wc_ce_id property, like this:

    add_filter( 'alg_wc_custom_emails_do_send_order_email', function ( $do_send, $email, $order ) {
        if ( 1 == $email->alg_wc_ce_id ) { // for the "Custom email #1"
            return $order->has_status( 'on-hold' );
        }
        return $do_send;
    }, 10, 3 );
    #133973
    Tom Anbinder
    Moderator
    Plugin Support

    Update: Since the plugin v2.8.0, it’s now possible to achieve the same without the snippet – with the new “Require order status” (and “Exclude order status”) option (in “WooCommerce > Settings > Emails > Custom email #X > Order Options”).

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