更新时间:2023-11-30 09:18:16
更新2
woocommerce_email_recipient_{$email_id}
过滤器是一个复合钩子,在其中设置的正确的电子邮件ID是customer_on_hold_order
而不是customer_on_hold_order_order
,这将不起作用…
The woocommerce_email_recipient_{$email_id}
filter is a composite hook and the right email ID to set in it is customer_on_hold_order
and not customer_on_hold_order_order
which will not work…
使用WC_Order
对象,从Woocommerce 3开始,您需要使用
With the WC_Order
object, since Woocommerce 3, you need to use get_payment_method()
method.
为避免除"Bacs"付款方式外的客户保留"电子邮件通知,请使用:
To avoid Customer ON Hold email notification except for "Bacs" payment method use:
add_filter( 'woocommerce_email_recipient_customer_on_hold_order', 'customer_on_hold_order_for_bacs', 10, 2 );
function customer_on_hold_order_for_bacs( $recipient, $order ) {
if( is_a('WC_Order', $order) && $order->get_payment_method() !== 'bacs' ){
$recipient = '';
}
return $recipient;
}
代码进入您的活动子主题(活动主题)的function.php文件中.经过测试,可以正常工作.
Code goes in function.php file of your active child theme (active theme). Tested and works.