Add Bcc address to all WooCommerce emails

Record keeping is an important part of operating a business. Having a paper trail for reference can save you from customer order conflicts and this post will show you one method to accomplish this. Knowing exactly which email notifications have been sent from Woocommerce for an order will help you to solve those issues quickly.

Sending a copy of each Woocommerce email notification to a dedicated email box can be a great way to keep a record of communication with your customers. It can be used as a lookup tool in case of confusion or disagreement about an order.

We don’t want to make it obvious that we’re sending the same email to ourselves, so we’ll make use of the email blind copy.

In order to Bcc an email address in WordPress it’s necessary to modify the email headers directly. This can be done a couple of ways, but neither of them is very pretty. Place the hook and function below into your functions.php file or relevant class file.

function modify_mail_headers( $params, \WC_Email $email ){

	// Add conditionals here
    $condition = true;

	if ( $condition ) {
        // Concatenate the header and end with a line break
		$params[3] .= 'bcc: [email protected]' . "\r\n";
	}

	return $params;
}

add_filter( 'woocommerce_mail_callback_params', 'modify_mail_headers', 50, 2 );

It’s also possible to use a different hook named woocommerce_email_headers, which passes slightly different callback parameters.

This method will intercept all Woocommerce emails and apply the change to any notification that passes your condition.

Enjoy!