Delay WooCommerce order processing mail - php

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 ),

Related

Change WooCommerce order status change without sending email notification

I am trying to stop woo-commerce from sending mail when order status is changed. These orders are of amazon and my plugin syncs it from amazon to woo-commerce. On doing so, mail from both amazon and woo-commerce went, which irritated the clients. So I want to stop email functionality to be stopped when status is changed from my plugin. the code to change status is
$WooOrder = wc_get_order($value->post_id);
$WooOrder->set_address($OrderData['billing'], 'billing')
$WooOrder->update_status($wooOrderStatus) // $wooOrderStatus is set above
Are there any flags that can be set to avoid sending mails?
Any kinds of helps are highly appreciated.
Instead of using WC_Order update_status() method, simply use wp_update_post() as follow:
$WooOrder = wc_get_order($value->post_id);
$WooOrder->set_address($OrderData['billing'], 'billing');
$WooOrder->save();
// Change order status
wp_update_post(['ID' => $value->post_id, 'post_status' => 'wc-'.$wooOrderStatus]);
This should change the Order status without sending an email notification.
Note: Post status for WooCommerce Orders always start with wc-

Drupal MailChimp Ecommerce Recover Abandoned Cart

I am trying to integrate MailChimp to my Drupal 7 site. But I am facing some problems right now.
What I can do:
I can subscribe new users to my MailChimp list.
I can send order data to MailChimp when a customer completes their purchase.
I can send Welcome Message campaign email.
I can send First Purchase campaign email.
I can send follow up mails for these campaign mails (for example; send mail after 1 hour if a subscriber receives First Purhcase email).
What I can not do:
I can not send Abandoned Cart campaign emails.
I can not show product info on ecommerce mails.
I can not see Cart data when I make a POST request to usX.api.mailchimp.com/3.0/ecommerce/stores/{store_id}/carts
I would like to give more info if needed.
edit: fixed grammar
edit: I can see Cart data when I make a POST request to usX.api.mailchimp.com/3.0/ecommerce/stores/{store_id}/carts. To achieve that, I have just deleted cart data in my Drupal 7 commerce website. So it kind of worked like a soft restart.
I have found the issue and fixed it.
For future readers;
The issue was that, MailChimp eCommerce module is not sending the checkout_url(path to the cart) out of the box. Although it is not required to sent checkout_url while POSTing, it is mandatory if you want to use Abandoned Cart email. In order to fix that problem, there are two patches that needs to applied.
Patch #1
Patch #2
original link for the solution
Hope this helps someone :)

Woocommerce Order Completed Email notification

I am trying to find a way to send out an email once the order has been completed within WooCommerce store. How would I go about sending an auto email once the product/order has been ticked finish.
Thanks
WooCommerce automatically send the processing email to user when you place any order and also send the mail to admin for new order you have to do nothing. Are you getting any type of error or something? because after installation all thing works automatically.

WooCommerce Hook before "New Order"-Mail is sent

During my WooCommerce order, the user selects an image that gets uploaded to the server. Now I need to edit this image (resize, trim etc. with ImageMagick) BEFORE the "new Order" emails are sent, because I attach this image to these emails.
I tried the payment_complete hook, but this one is too late, the mails are already sent. I also thought about doing it in the mail templates, but it only needs to be done once, so it has to especially be before the mails are sent out.
Of course it should happen on the server after the "thank you" page, the user shouldn't have to wait for this processing.
Edit: The hook should deliver the order id because I need to access the order items.
Where can I insert/hook my code to achieve this?
Thank you!
Well the new order emails are triggered to run on the woocommerce_order_status_pending_to_processing_notification and woocommerce_order_status_pending_to_on-hold_notification hooks, with default (10) priority.
Therefore, you should be able to run your code on the same hooks with a lower priority (say, 5).
Failing that, you could skip the notification and just focus on the order status change, so the following hooks:
woocommerce_order_status_pending_to_processing and woocommerce_order_status_pending_to_on-hold

Magento Payment Information not showing on new orders or transactional emails

Strange issue here, in which I am not sure of what the problem maybe.
When I create new orders through the backend using COD/Purchase Order/Bank Transfer as the payment method, this information is not saved and visible in the payment information block, and as such a result not visible on the transactional emails.
The Payment Information section just displays "Order was placed using GBP"
Any ideas?
That's not a bug, that's Magento !
Bank wire informations are shown nowhere expect on the "payment method" selection before having placed the order, and in the order confirmation printable doc.
That sucks, that's it :)
(Magento 1.7.0.0 here)

Categories