Skip to content

Instantly share code, notes, and snippets.

@nczz
Created May 25, 2019 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nczz/2dd495d4b931fe4426de513ac356899e to your computer and use it in GitHub Desktop.
Save nczz/2dd495d4b931fe4426de513ac356899e to your computer and use it in GitHub Desktop.
[WooCommerce] 程式化觸發訂單狀態發信機制
<?php
function mxp_woo_cao_cancel_order_event($order_id){
$mailer = WC()->mailer();
$mails = $mailer->get_emails();
if ( ! empty( $mails ) ) {
foreach ( $mails as $mail ) {
if ( $mail->id == 'cancelled_order' ) {
$mail->trigger( $order_id );
}
}
}
}
add_action('woo_cao_cancel_order','mxp_woo_cao_cancel_order_event',11,1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment