Last active
December 18, 2017 10:50
-
-
Save webdados/d60eccbc7f283e0f9f841e2641870a5b to your computer and use it in GitHub Desktop.
Send cancelled pending orders email notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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