Update 2
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…
With the WC_Order
object, since Woocommerce 3, you need to use get_payment_method()
method.
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;
}
Code goes in function.php file of your active child theme (active theme). Tested and works.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…