Guest User

Untitled

a guest
Aug 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. add_action('woocommerce_order_status_changed', 'bdev_send_cancelled_order_email_notification_to_customer', 10, 4 );
  2. function bdev_send_cancelled_order_email_notification_to_customer( $order_id, $old_status, $new_status, $order ){
  3. if ( $new_status == 'cancelled' || $new_status == 'failed' ){
  4. $wc_emails = WC()->mailer()->get_emails();
  5. $customer_email = $order->get_billing_email();
  6. }
  7.  
  8. if ( $new_status == 'cancelled' ) {
  9. $wc_emails['WC_Email_Cancelled_Order']->recipient = $customer_email;
  10. $wc_emails['WC_Email_Cancelled_Order']->trigger( $order_id );
  11. }
  12. elseif ( $new_status == 'failed' ) {
  13. $wc_emails['WC_Email_failed_Order']->recipient = $customer_email;
  14. $wc_emails['WC_Email_failed_Order']->trigger( $order_id );
  15. }
  16. }
Add Comment
Please, Sign In to add comment