Skip to content

Instantly share code, notes, and snippets.

@webdados
Last active December 18, 2017 10:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save webdados/d60eccbc7f283e0f9f841e2641870a5b to your computer and use it in GitHub Desktop.
Save webdados/d60eccbc7f283e0f9f841e2641870a5b to your computer and use it in GitHub Desktop.
Send cancelled pending orders email notifications
<?php
/* WooCommerce emails for cancelled pending orders */
add_action('woocommerce_order_status_pending_to_cancelled', 'pending_cancelled_send_an_email_notification', 10, 2 );
function pending_cancelled_send_an_email_notification( $order_id, $order ) {
if ( version_compare( WC_VERSION, '3.0.8', '>=' ) ) {
// Getting all WC_emails objects
$email_notifications = WC()->mailer()->get_emails();
// Sending the email
$email_notifications['WC_Email_Cancelled_Order']->trigger( $order_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment