Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Woocommerce BCC on order email to admin

When someone makes an order in woocommerce, you get an email of the order as the administrator. I'd like to add additional recipients for this email. However! I'd only like this extra BCC to be made on these exact mails. Not all the other mails going through.

What is said in this thread applies to all mails, and not specificly the order emails that the admin gets: Additional recipients on woocommerce invoice

like image 334
user2215771 Avatar asked Apr 15 '14 18:04

user2215771


1 Answers

Try this code:

add_filter( 'woocommerce_email_headers', 'add_bcc_to_wc_admin_new_order', 10, 3 );
function add_bcc_to_wc_admin_new_order( $headers = '', $id = '', $wc_email = array() ) {
    if ( $id == 'new_order' ) {
        $headers .= "Bcc: [email protected]\r\n"; // replace [email protected] with your email
    }
    return $headers;
}

This code is tested in WC 2.1

like image 68
Ratnakar - StoreApps Avatar answered Sep 30 '22 17:09

Ratnakar - StoreApps