Hello,
We appreciate your suggestion on customer email and we have added it our next hot release #5.
Thanks.
thanks guys! I was working on exactly the same thing, luckily I checked the github and noticed it was already on there, tested it and it works… shaved a few hours *back* onto my life – and that doesn’t happen often. 🙂
I submitted a pull request for adding some needed stripslashes as my contribution.
…plus another thought, if the recipient field is no longer used when the customer box is checked, then you could add another checkbox option to send a BCC copy to the recipient field so the admin can see and monitor the results of the actual emails sent, while not revealing their email to the customer…
something like this?
add_filter( 'woocommerce_email_headers', 'custom_add_bcc_to_email', 10, 3);
function custom_add_bcc_to_email( $headers, $email_id, $order ) {
$wcemails = get_option( 'wcemails_email_details', array() );
if ( ! empty( $wcemails ) ) {
foreach ( $wcemails as $wcemail ) {
if ($wcemail['bcctorecipent'] == '1') {
$wcemailids[] = $wcemail['id'];
$recipients[$wcemail['id']] = $wcemail['recipients'];
}
}
}
if (in_array($email_id,$wcemailids)) {
$headers[0] = 'Bcc: '.$recipients[$email_id];
}
return $headers;
}
it does work I have changed it slightly from what I was using so may need to be tested again tho…
what needs to be tested further here may be whether it is better to add to or replace the existing headers, and whether the text/html line may be needed if replacing them like this. eg.
$headers[1] = 'Content-Type: text/html';
Plugin Contributor
Utkarsh
(@utkarshpatel)
Hey,
Thank you for giving suggestion.
You can track your suggestion here.