Add perch to new order form for woocommerce
How can I add BCC or CC to woo commerce, new email order?
I think this is the code that is running the new order emails: http://codepad.org/kPTpSIM0 I can't seem to find what I need on Google. Thank you in advance.
I found this, but I don't know where it goes:
add_filter( 'woocommerce_email_headers', 'add_bcc_all_emails', 10, 2);
function add_bcc_all_emails($headers, $object) {
$headers = array();
$headers[] = 'Bcc: Name <me@email.com>';
$headers[] = 'Content-Type: text/html';
return $headers;
}
+3
source to share
2 answers
Well, it looks like you've already read this answer , as this is the recommended code, although I believe it will add BCC to all emails, not just new orders.
I would suggest the following instead:
add_filter( 'woocommerce_email_headers', 'add_bcc_all_emails', 10, 3);
function add_bcc_all_emails( $headers, $email_id, $order ) {
if( 'new_order' == $email_id ){
$headers .= "Bcc: Name <me@email.com>" . "\r\n";
}
return $headers;
}
As for "where the code goes", it needs to be turned into a plugin. Depending on how easily you can disable this code in the future, you can write it as a regular plugin (disable viewing plugins)) or as a site-specific plugin (permanent until you delete the file via FTP).
+5
source to share