实际上有一个过滤器可以使用,请参见abstract-wc-email.php
, 第214行:
return apply_filters( \'woocommerce_email_recipient_\' . $this->id, $this->recipient, $this->object );
您可以在函数中输入以下内容。php:
add_filter( \'woocommerce_email_recipient_customer_completed_order\', \'your_email_recipient_filter_function\', 10, 2);
function your_email_recipient_filter_function($recipient, $object) {
$recipient = $recipient . \', [email protected]\';
return $recipient;
}
唯一的缺点是收件人会同时看到您的地址和;他自己在To:领域。
或者,根据Steve的答案,您可以使用woocommerce_email_headers
滤器传递的$对象允许您仅将此应用于已完成的订单电子邮件:
add_filter( \'woocommerce_email_headers\', \'mycustom_headers_filter_function\', 10, 2);
function mycustom_headers_filter_function( $headers, $object ) {
if ($object == \'customer_completed_order\') {
$headers .= \'BCC: My name <[email protected]>\' . "\\r\\n";
}
return $headers;
}