How To Send A CC or BCC of Customer E-Mails in WooCommerce To Other E-Mail Address

How To Send A CC or BCC of Customer E-Mails in WooCommerce To Other E-Mail Address
Vanja K.
Vanja K.
December 14, 2020
1 min read

For those running WooCommerce either for themselves or for their clients, the question we’re about to answer below comes into view quite often. Basically, most of our  clients want to have this option. After all, checking the e-mails that are sent to your customers is a great way to further troubleshoot any issues, but also, to ensure that  all the e-mails get sent out and that they contain all the necessary information. That’s why the code snippet added below will help you CC or BCC your customer e-mails to another e-mail address, preferably your own. Here’s the code below.

/** Send out a copy of WooCommerce e-mails to another address **/

add_filter( 'woocommerce_email_headers', 'woocommerce_email_headers_nucleusmarketing', 10, 4 );
function woocommerce_email_headers_nucleusmarketing( $header, $email_id, $email_for_obj, $email_class ) {
// Bcc this email address to *all* WooCommerce emails.
$header .= 'Bcc: accounting@nucleusmarketing.org' . "\r\n";

// Add another address to the Order Completed emails only.
if ( 'customer_completed_order' == $email_id ) {
$header .= 'Bcc: accounting@nucleusmarketing.org' . "\r\n";
}

return $header;
}

Copy

While WooCommerce doesn’t provide this feature out of the box, the above solution will simply create a BCC to your accounting and/or any e-mail address you want the customer confirmation e-mails (eg. processing order, completed order, etc.) to go to. It’s easy, works with the current WordPress 5.6 and WooCommerce 4.8.0 versions. Please free to send us a note if you find this code not working, we’ll appreciate it.

OUR BLOGS
We got more related posts, check them out! Related Posts