How to send "admin new order e-mail" additionally in cc to office@mydomain.com when new order has products from category id = "99" ?
Can anyone help me?
How to send "admin new order e-mail" additionally in cc to office@mydomain.com when new order has products from category id = "99" ?
Can anyone help me?
I guess something like this should do the trick:
add_filter( 'woocommerce_email_headers','stack_overflow_add_cc_to_new_order_email',10,4 );
function stack_overflow_add_cc_to_new_order_email( $header, $mail_id, $mail_obj, $wc_email ) {
if ( $mail_id == "new_order" ) {
$header .= "Cc: Name <your@email.com>" . "\r\n"; // del if not needed
}
return $header;
}
The explanation is simple, everytime a WC email is sent the woocommerce_email_headers is called. Inside that filter you gain access to the "id" of the email (the way wc distinguish the emails) so you can check if it's the new_order email and if so add the corrisponding header to the email.
I didn't test the code but it should work. Place that code inside your theme function.php file