我想在wp-woocommerce中停止本地提货的订单完整通知

时间:2016-06-29 11:13:14

标签: php wordpress woocommerce

我想在我的孩子主题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;

    $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);

1 个答案:

答案 0 :(得分:0)

' woocommerce_email'可能行不通。使用hook' woocommerce_order_status_completed'代替。