Last active
January 27, 2018 17:59
-
-
Save grola/da416b169b805f5bbf76362df79c063c to your computer and use it in GitHub Desktop.
Send new order email to additional reciepient wher coupon applied
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 | |
add_filter( 'woocommerce_email_recipient_new_order', 'studiowp_woocommerce_email_recipient_new_order', 10, 2 ); | |
function studiowp_woocommerce_email_recipient_new_order( $recipient, $order ) { | |
$coupon_code = 'XXXXXXXX'; | |
$add_recipient = 'email@domain.com'; | |
if ( in_array( strtolower( $coupon_code ), $order->get_used_coupons() ) ) { | |
$recipient .= ',' . $add_recipient; | |
} | |
return $recipient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exploration for this code https://en.studiowp.net/send-new-order-email-additional-address-coupon-applied/