Created
May 9, 2019 15:38
-
-
Save nczz/762b2454ee51c8c141c37e3689f35c2f to your computer and use it in GitHub Desktop.
[WordPress] WooCommerce 訂單取消或失敗發信通知客戶
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 | |
//https://stackoverflow.com/questions/51635878/send-cancelled-and-failed-order-email-to-customer-in-woocommerce-3 | |
add_filter( 'woocommerce_email_recipient_cancelled_order', 'wc_cancelled_order_add_customer_email', 10, 2 ); | |
add_filter( 'woocommerce_email_recipient_failed_order', 'wc_cancelled_order_add_customer_email', 10, 2 ); | |
function wc_cancelled_order_add_customer_email( $recipient, $order ){ | |
// Avoiding errors in backend (mandatory when using $order argument) | |
if ( ! is_a( $order, 'WC_Order' ) ) return $recipient; | |
return $recipient .= "," . $order->get_billing_email(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment