[英]Add a Supplier custom field email address as BCC to woocommerce email New Order
我有一个假期让 wordpress 站点在添加列表页面中有高级自定义字段“供应商电子邮件”。 When a rental is booked the Supplier Email needs to be added to the woocommerce New Order email under BCC, i have tried numerous options but they have not worked, the Supplier Email is in the post meta so it needs to be pulled in to the new订购 email。 这是我的函数中的代码。php 文件:
add_filter( 'woocommerce_email_headers', 'bcc_to_email_headers', 10, 3 );
function bcc_to_email_headers( $headers, $email_id, $order ) {
if ( $email_id === 'new_order' ) {
$supplier_email = get_field( 'supplier_email_main',$post_id);
if ( $supplier_email ) {
$headers .= "CC: Supplier <" . $supplier_email . ">\r\n";
$headers .= "BCC: New Order <myemail@gmail.com>" . "\r\n";
}
}
return $headers;
}
gmail 地址(这将是 go 到我个人的 email,出于明显的原因将其隐藏在这里)我添加到 BCC 甚至没有发送。 不知道如何继续,任何帮助将不胜感激,请注意我不是 wordpress 开发人员。 提前致谢。
尝试这个
add_filter( 'woocommerce_email_headers', 'add_bcc_header', 10, 3 );
function add_bcc_header( $headers, $id, $order ) {
if ( $id == 'new_order' ) {
$headers .= 'Bcc: gmailaddress@gmail.com' . "\r\n";
}
return $headers;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.