Bobz
Bobz

Reputation: 2399

Additional recipients on woocommerce invoice

Is there way to add additional recipients to woocommerce invoice mail. I have tried to use 'woocommerce_email_headers' hook, but it's not working:

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);

function mycustom_headers_filter_function($headers, $object) {
    $headers = array();
    $headers[] = 'Bcc: My Name <[email protected]>';
    $headers[] = 'Content-Type: text/html';
    return $headers;
}

Any advice?

Upvotes: 3

Views: 1980

Answers (3)

Brian Bugler
Brian Bugler

Reputation: 1

I needed help to add a BCC to a New Customer Account email. Here is what I came up with. It's slightly different than above. Hope this helps someone.

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

Upvotes: 0

adamj
adamj

Reputation: 4792

You can expand the function to include the order as well:

add_filter( 'woocommerce_email_headers', 'woo_cc_emails', 10, 3 );

function woo_cc_emails( $headers, $status, $object ) {
    return 'Bcc: [email protected]' . "\r\n";
}

Upvotes: 2

Viktor Vasilev
Viktor Vasilev

Reputation: 1

Some months later, but I hope this will help someone.

add_filter('woocommerce_email_headers', 'woo_cc_emails');
function woo_cc_emails() {
  return 'Bcc: [email protected]' . "\r\n";
}

You can change "Bcc", with "To" or "Cc".

Upvotes: 0

Related Questions