Created
March 26, 2019 15:06
-
-
Save jesseeproductions/39c85cfbc798a228a86721412b8ad714 to your computer and use it in GitHub Desktop.
Send Bcc Email for WooCommerce Tickets
This file contains hidden or 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
/** | |
* Function adds a BCC header to emails that match our array | |
* | |
* based off snippet from https://jessepearson.net/2016/10/adding-bcc-emails-woocommerce/ | |
* | |
* @param string $headers The default headers being used | |
* @param string $object The email type/object that is being processed | |
*/ | |
function tribe_add_bcc_to_certain_emails( $headers, $object ) { | |
// email types/objects to add bcc to | |
$add_bcc_to = array( | |
'wootickets', | |
); | |
if ( in_array( $object, $add_bcc_to ) ) { | |
$headers = array( | |
$headers, | |
'Bcc: Me <[email protected]>' ."\r\n", | |
); | |
} | |
return $headers; | |
} | |
add_filter( 'woocommerce_email_headers', 'tribe_add_bcc_to_certain_emails', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment