WooCommerce default mode is to send an email to the client when order status change happens. But how can the admin / store manager know when these changes are made? Keeping the orders page open 24/7 and refresh the view is not a solution.
I have tried the following code, however this does not work for custom order status.
add_filter('woocommerce_email_recipient_customer_processing_order', 'email_recipient_custom_notification', 10, 2);
function email_recipient_custom_notification( $recipient, $order ) {
if ( ! is_a( $order, 'WC_Order' ) ) return $recipient;
error_log("Hello: woocommerce_email_recipient_customer_processing_order : recipient = " . $recipient . "\n" );
// Set HERE your replacement recipient email(s)… (If multiple, separate them by a coma)
$recipient .= ', admin@xyz.com';
return $recipient;
}
add_filter('woocommerce_email_recipient_customer_out-to-delivery_order', 'email_out_to_delivery_notification', 10, 2);
function email_out_to_delivery_notification( $recipient, $order ) {
if ( ! is_a( $order, 'WC_Order' ) ) return $recipient;
error_log("Hello: woocommerce_email_recipient_customer_out-to-delivery_order : recipient
= " . $recipient . "\n" );
// Set HERE your replacement recipient email(s)… (If multiple, separate them by a coma)
$recipient .= ', admin@xyz.com';
return $recipient;
}
Note that 'out-to-delivery' is the custom order status that I have successfully added. I am able to change the order status from "On-hold --> Processing --> Out-To-Delivery --> Completed".
With the above changes site admin get the notification for 'New-Order' and 'Processing' order status. But he doesn't get notification for 'Out-To-Delivery' or 'Completed' status change. Seems that the filter 'woocommerce_email_recipient_customer_out-to-delivery_order' that I have used doesn't work.
Thanks