Skip to content

Instantly share code, notes, and snippets.

@jesseeproductions
Created March 26, 2019 15:06
Show Gist options
  • Save jesseeproductions/39c85cfbc798a228a86721412b8ad714 to your computer and use it in GitHub Desktop.
Save jesseeproductions/39c85cfbc798a228a86721412b8ad714 to your computer and use it in GitHub Desktop.
Send Bcc Email for WooCommerce Tickets
/**
* 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