Skip to content

Instantly share code, notes, and snippets.

@grola
Last active January 27, 2018 17:59
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 grola/da416b169b805f5bbf76362df79c063c to your computer and use it in GitHub Desktop.
Save grola/da416b169b805f5bbf76362df79c063c to your computer and use it in GitHub Desktop.
Send new order email to additional reciepient wher coupon applied
<?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;
}
@grola
Copy link
Author

grola commented Jan 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment