Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Last active January 7, 2023 22:44
Show Gist options
  • Save helgatheviking/ca492e4a90b3fcc1cc3f3413638d3df6 to your computer and use it in GitHub Desktop.
Save helgatheviking/ca492e4a90b3fcc1cc3f3413638d3df6 to your computer and use it in GitHub Desktop.
Add BCC to certain store emails
/**
* Add BCC to certain store emails.
*
* @param string $headers
* @param string $email_id
* @return string
*/
function kia_add_bcc_to_specific_emails( $headers, $email_id ) {
$bbc_these_emails = array(
'customer_completed_order', // Add other emails as entries in this array.
);
if ( in_array( $email_id, $bbc_these_emails ) ) {
$headers = array(
$headers,
'Bcc: Me <[email protected]>' ."\r\n", // Modify the email as needed.
);
}
return $headers;
}
add_filter( 'woocommerce_email_headers', 'kia_add_bcc_to_specific_emails', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment