3

有没有办法向 woocommerce 发票邮件添加其他收件人。我曾尝试使用“woocommerce_email_headers”钩子,但它不起作用:

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);

function mycustom_headers_filter_function($headers, $object) {
    $headers = array();
    $headers[] = 'Bcc: My Name <me@gmail.com>';
    $headers[] = 'Content-Type: text/html';
    return $headers;
}

有什么建议吗?

4

3 回答 3

2

您也可以扩展该函数以包含订单:

add_filter( 'woocommerce_email_headers', 'woo_cc_emails', 10, 3 );

function woo_cc_emails( $headers, $status, $object ) {
    return 'Bcc: your@email.here' . "\r\n";
}
于 2014-10-26T02:03:11.597 回答
0

几个月后,但我希望这会对某人有所帮助。

add_filter('woocommerce_email_headers', 'woo_cc_emails');
function woo_cc_emails() {
  return 'Bcc: your@email.here' . "\r\n";
}

您可以使用“收件人”或“抄送”更改“密件抄送”。

于 2014-01-25T12:11:27.143 回答
0

我需要帮助才能将密件抄送添加到新客户帐户电子邮件。这是我想出的。与上面的略有不同。希望这可以帮助某人。

add_filter( 'woocommerce_email_headers', 'add_bcc_to_wc_customer_new_account', 10, 3 );
function add_bcc_to_wc_customer_new_account( $headers = '', $id = '', $wc_email = array() ) {
if ( $id == 'customer_new_account' ) {
    $headers .= "Bcc: my_personal@email.com\r\n"; // replace my_personal@email.com with your email
}
return $headers;
}
于 2016-08-31T20:14:39.000 回答