WooCommerce Cancelled email notification Not sent when Order expires

試著忘記壹切 提交于 2019-12-04 12:43:43

To force "Cancelled" email-notification to be sent, you could try the following:

add_action('woocommerce_order_status_changed', 'cancelled_order_email_notifications', 10, 4 );
function cancelled_order_email_notifications( $order_id, $old_status, $new_status, $order ){
    // Only when order status is changed to 'cancelled'
    if ( $new_status != 'cancelled' ) return;

    // Send cancelled email notification
    WC()->mailer()->get_emails()['WC_Email_Cancelled_Order']->trigger( $order_id ); 
}

Code goes in function.php file of your active child theme (or active theme).

Tested and works.

Notes:
- This email notification is only sent to admin.
- Copying the related template file to your child theme will not help to send this notification.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!