Last active
February 11, 2021 12:50
-
-
Save nilsbosman/b4bdf6e5be3b058c9551991393bfb72b to your computer and use it in GitHub Desktop.
Add CC and BCC to WooCommerce Emails
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
<?php | |
// place this code in your functions.php file. | |
function add_cc_to_certain_emails( $headers, $id ) { | |
// Define the email type and check if true (You can use all woocommerce email types, for more info: https://docs.woocommerce.com/wc-apidocs/class-WC_Email.html) | |
if ( 'new_order' === $id ) { | |
$headers .= "Cc: FirstName LastName <[email protected]>\r\n"; | |
$headers .= "Bcc: FirstName LastName <[email protected]>\r\n"; | |
// You can add more extra email headers here. Make sure you use $headers .= otherwise it will overwrite the variable. | |
} | |
return $headers; | |
} | |
add_filter( 'woocommerce_email_headers', 'add_cc_to_certain_emails', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment