Last active
January 7, 2023 22:44
-
-
Save helgatheviking/ca492e4a90b3fcc1cc3f3413638d3df6 to your computer and use it in GitHub Desktop.
Add BCC to certain store emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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