1

I have a question regards delaying a WooCommerce Out of the box email notifications. We use WooCommerce Shipment tracking and also Dokan plugins. And therefore we also have suborders: A suborder has also a tracking code. We provide that information in the parent order processing mail.

When a new order comes in, the shipment tracking is empty. I guess this is because the mail is sent too fast. I think this because of the reason, that when I send the processing mail from the admin backend manually, then I have all info. So the code is fully working. I only have the problem with the automatically sent mail from WooCommerce when a new order comes in.

I found this but there is no time delay: Send an Email notification to the admin for pending order status in WooCommerce

Also, I found this plugin code on Github from Damien Carbery. But I don't know if I can just copy the code and make changes to it?

This is the part that I should change maybe:

'woocommerce_order_status_pending_to_processing' => array( 'WC_Email_New_Order', $this->default_defer_time ),
LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Nik7
  • 346
  • 2
  • 16
  • 1
    Sorry, I use OOTB for Out-of-the-box :) – Nik7 Feb 11 '21 at 15:40
  • @LoicTheAztec I check the code from link two again. Do I really have to sue this full code? Is there a simple solution? – Nik7 Feb 12 '21 at 11:59
  • 1
    Why you don't use the plugin: copy the code to a txt file and save it as `wc-defer-order-emails.php` … add the file in a folder that you can name for example `woocommerce-defer-order-emails`. Zip the folder and upload it as a plugin in Wordpress > plugins dashboard… – LoicTheAztec Feb 12 '21 at 12:21
  • I did that already, But there is no setting page. And I do not 100% understand which code lines I have to chnage – Nik7 Feb 12 '21 at 15:51
  • 1
    I will have a look to the plugin code (I just clone it as a Gist in github). – LoicTheAztec Feb 12 '21 at 16:10
  • @LoicTheAztec I tried to adjust the plugin code and uncomment the line'woocommerce_order_status_pending_to_processing' => array( 'WC_Email_New_Order', $this->default_defer_time ), and comment the other lines. In my understanding this should only the work for order processing mail. But It does not work. No error or so.. I guess something is wrong with my code here. Can you maybe share the link to your github? – Nik7 Feb 18 '21 at 16:28
  • @LoicTheAztec - your plugin in here https://gist.github.com/lomars/a1f0a17431154846be1a630fc6ee02c9 works fine but I am wondering if there is a way to postpone only my custom emails after order completed. Your code delays all emails when changed to certain status. I would like to send 30 day after placing order an email with review request. Is there a way to do it without cron? – Vlado Aug 30 '23 at 08:06
  • I suppose that it's possible. The most reliable way is to use [Action Scheduler](https://wordpress.org/plugins/action-scheduler/) plugin, a scalable, traceable job queue for background processing, used by WooCommerce and WooCommerce Subscriptions (and some other huge plugins). – LoicTheAztec Aug 30 '23 at 08:19

0 Answers0