How to Get email recipient to make an conditional function to add extra bcc email header on email only to admin OR by Order Status?
add_filter( 'woocommerce_email_headers', 'profit_extra_email', 10, 2);
function profit_extra_email( $headers ) {
$headers .= 'BCC: Vendas Promocional Fitness <eu@site.com>' . "\r\n";
return $headers;
}
This function above work, but bcc email retrieve all emails. I need retrieve only emails to admin OR by Order Status.
Help any!! :O
There are 3 variables passed to the
woocommerce_email_headers
filter. Since none of them appear to be the$in_admin
variable that is passed to templates, we have to take a different approach. The second param is$email_id
which is a unique identifier for each email class. Therefore we can make an array of all the admin emails and check if the current email is in that array. If so, add your CC.