I'm trying to disable the completed order email only if the customer selects the "Retirada no local" shipping method.
I found the following code, which disables email for all shipping methods except one - it's not what I need, but it might help:
function filter_woocommerce_email_recipient_new_order( $recipient, $order = false ) { if ( ! $order || ! is_a( $order, 'WC_Order' ) ) return $recipient; // 获取配送方式 $shipping_method = $order->get_shipping_method(); // 不等于(注意:这应该根据您网站语言中的配送方式进行调整) // 例如:荷兰语中的“Afhalen”等... if ( $shipping_method != 'Local Pickup' ) { $recipient = ''; } return $recipient; } add_filter( 'woocommerce_email_recipient_new_order', 'filter_woocommerce_email_recipient_new_order', 10, 2 );```
Change the version of the code you provided to one that disables the "Order Completed" customer email when shipping method is "Retirada no local"
Please note that your shipping method must exactly match the words and capital letters of the phrase "Retirada no local" for this code to be valid.