Reputation: 548
I need to send a customer email notification when I manually set order status from processing
to on-hold
status. I have added the following action hook into my functions.php
file:
add_action( 'woocommerce_order_status_processing_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
Its not working (not showing in WP Mail Log), even though this particular email notification is enabled in woocommerce settings and the similar hook as shown below is working just fine:
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
Environment: Woocommerce v.3.5.1 Wordpress v.4.9.9 PHP 5.6
Any help would be much appreciated.
Upvotes: 3
Views: 3147
Reputation: 253784
Updated the hook
You should try the following hooked function instead:
add_action( 'woocommerce_order_status_processing_to_on-hold', 'enable_processing_to_on_hold_notification', 10, 2 );
function enable_processing_to_on_hold_notification( $order_id, $order ){
// Getting all WC_emails array objects
$mailer = WC()->mailer()->get_emails();
// Send the "On Hold" notification
$mailer['WC_Email_Customer_On_Hold_Order']->trigger( $order_id );
}
Code goes in function.php file of your active child theme (active theme). It should works.
Upvotes: 6