Skip to content

Instantly share code, notes, and snippets.

@lukecav
Created October 3, 2017 13:37
Show Gist options
  • Select an option

  • Save lukecav/ad513636b166ba54c03e34d2323f52b5 to your computer and use it in GitHub Desktop.

Select an option

Save lukecav/ad513636b166ba54c03e34d2323f52b5 to your computer and use it in GitHub Desktop.
Send an email notification when order status change from pending to cancelled in WooCommerce
add_action('woocommerce_order_status_pending_to_cancelled', 'cancelled_send_an_email_notification', 10, 2 );
function cancelled_send_an_email_notification( $order_id, $order ){
// Getting all WC_emails objects
$email_notifications = WC()->mailer()->get_emails();
// Sending the email
$email_notifications['WC_Email_Cancelled_Order']->trigger( $order_id );
}
@lukecav

lukecav commented Oct 3, 2017

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment