Hey @vernonwebsites ,
I saw that the code shared in your thread is meant to manually change the order status from On Hold to Processing. Since the On Hold status is still being applied first, it’s triggering the WooCommerce On Hold email before the status updates to Processing. Because this setup extends the default behavior manually, it might not be working exactly as you’d like.
One workaround you could try is disabling the On Hold order email by going to WooCommerce > Settings > Emails > On Hold Order and turning it off. Then, you can manually enable it whenever you actually want to use that status. This way, it won’t trigger unexpectedly.
If that doesn’t quite work for you, here’s another option: you can use this snippet to ensure the On Hold email only sends when an order is manually set to On Hold from a different status:
// Send 'On Hold' email notification when order is manually set to 'On Hold'
add_action( 'woocommerce_order_status_changed', 'send_on_hold_email_on_manual_status_change', 10, 4 );
function send_on_hold_email_on_manual_status_change( $order_id, $old_status, $new_status, $order ) {
if ( 'on-hold' === $new_status && 'on-hold' !== $old_status ) {
WC()->mailer()->get_emails()['WC_Email_Customer_On_Hold_Order']->trigger( $order_id );
}
}
Give that a shot and let me know how it goes!
thanks for this… I spent way too much time in this but when I get into something it’s hard to stop until I get it working. Lol
I actually switched to “COD” payment so now when the order is submitted it sends the processing email to the customer and new order email to the admin (as usual). I edited the email template for the text I needed in the email. (Mentioning the admin will contact them about shipping quotes)
Use is that some customers will order for shipping but the items to be shipped are all non standard types of items so automatic shipping quotes won’t work… The customer picks shipping, and when the new order comes in the admin contacts them with shipping options/quotes. When agreed, the admin then goes to the order and sets to on hold to be able to add the custom shipping amount. When the shipping is added the admin selects to send the customer the order information with the new total including shipping and the customer then pays through etransfer. Admin completed when the order is shipped.
Thanks for the clip, im sure this thread will be good for future reference. 🙏😎
Zee
(@doublezed2)
Hello vernonwebsites,
Thank you for your reply.
I am glad to know that you have resolved the issue.
Hopefully, this thread will be helpful for the WooCommerce community who face a similar case.
Have a great day!