Support » Plugin: WooCommerce » Delay emails by more than 10 sec

  • Resolved daymobrew

    (@daymobrew)


    I have enabled the defer of transactional emails with
    add_filter( 'woocommerce_defer_transactional_emails', '__return_true' );

    I would like to defer the order completed email by 600 seconds to allow Shippo push tracking info to my site. I have code to insert this info into the email.

    I stepped through the code with Visual Studio Code but could not see how I could change the defer time. I even modified a few wp_schedule_event() calls in WooCommerce to change 10 to 600 (purely as a test) but emails are still being sent almost immediately.

    I see the ‘woocommerce_allow_send_queued_transactional_email’ filter (with the order number and status change as args) but I’m not sure if returning false would be helpful.

    How can I defer (some) emails for 10 minutes?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Con Schneider

    (@conschneider)

    Automattic Happiness Engineer

    Hi there,

    How can I defer (some) emails for 10 minutes?

    I would try the following.

    1) Unhook the mail send.
    2) Register my own scheduled events which is scheduled for 10 minutes after the purchase that sends the mail via wp_schedule_event().

    Kind regards,

    Plugin Support EtienneP

    (@etiennep)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

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