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 / 362 Views

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.

DISCLAIMER:

Please use the code, advice, and information presented on this website with caution. Nucleus J.D.O.O, or any of its employees, cannot be held responsible for any damages that this code might cause. We always try to update the code shown on our website, but we cannot guarantee its functionality with various themes, templates, or coding. Please ensure that you test each code thoroughly in order to use it safely.

Need some of our services?
Get in
touch and we'll
send you a free cost estimate for your project!

    Contact Form Image
    MORE BLOGS
    We got more related posts, check them out!
    Contact Form 7 Update and Google reCaptcha Issues
    A few weeks ago, Contact Form 7, version  5.8 was released. It brought a lot of bug fixes and it’s one of the most important updates for this highly regarded contact plugin in a while. However, it brought on its own set of problems which we’re dealing with for several of our clients. But, before […]
    Vanja K.
    CEO & CTO
    Read More
    How to remove “Home” from WooCommerce Breadcrumbs
    An easy-to-add snippet of code that will clean up your single product pages and single blog posts This was a simple request, but a rather impactful request by one of our clients. Their eCommerce store, made in WooCommerce by our team displays breadcrumbs on top of their page. It’s a great way of showing the […]
    Vanja K.
    CEO & CTO
    Read More
    How To Add Your Company Logo To The WordPress Login Page
    We get asked this a lot: how to add your company’s logo to the backend login page for WordPress. It makes the whole thing look more prefessional, and in turn, makes the whole thing a lot more appealing to a lot of our clients who have more than one admin or shop manager. The procedure […]
    Vanja K.
    CEO & CTO
    Read More
    Newsletter
    Stay up to date. It's worth it.
    Newsletter Background Image