Last active
July 12, 2019 07:10
-
-
Save imran-khan1/29d40470ae1194fcbd2564b676ce74b2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/* | |
* Notification on order processing to cancelled status change | |
*/ | |
function ci_cancelled_notification( $order_id ) { | |
$order = wc_get_order( $order_id ); | |
// load the mailer class | |
$mailer = WC()->mailer(); | |
$recipient = '[email protected]'; | |
$subject = __('Your Subject', 'codeinform'); | |
$content = ci_get_cancelled_notification_content( $order, $subject, $mailer ); | |
$headers = "Content-Type: text/html\r\n"; | |
$mailer->send( $recipient, $subject, $content, $headers ); | |
} | |
add_action( 'woocommerce_order_status_processing_to_cancelled_notification', 'ci_cancelled_notification', 10, 1 ); | |
function ci_get_cancelled_notification_content( $order, $heading = false, $mailer ) { | |
$template = 'emails/admin-cancelled-order.php'; | |
return wc_get_template_html( $template, array( | |
'order' => $order, | |
'email_heading' => $heading, | |
'sent_to_admin' => true, | |
'plain_text' => false, | |
'email' => $mailer | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment