Php 我想停止在wp Woo Commerce中本地取货的订单完成通知
我想用my child theme function.php中的代码停止在WP woocommerce中完成本地取货的订单完整通知,但它不起作用,请任何人帮助我Php 我想停止在wp Woo Commerce中本地取货的订单完成通知,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我想用my child theme function.php中的代码停止在WP woocommerce中完成本地取货的订单完整通知,但它不起作用,请任何人帮助我 function wc_stop_order_notification( $email_class ){ global $post; $order = new WC_Order($post->ID); $wc_oreder_status = $post->post_status; $s
function wc_stop_order_notification( $email_class ){
global $post;
$order = new WC_Order($post->ID);
$wc_oreder_status = $post->post_status;
$shiping_method_used_in = $order->get_shipping_method();
if( $shiping_method_used_in == 'Local Pickup' && $wc_oreder_status == 'wc-completed'){
remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );
}
}
add_action( 'woocommerce_email', 'wc_stop_order_notification' ,99);
“woocommerce_email”可能不起作用。改为使用钩子“woocommerce\u order\u status\u completed”。“woocommerce\u email”可能不起作用。改为使用钩子“woocommerce\u order\u status\u completed”