禁用WooCommerce电子邮件通知以进行特定付款

时间:2019-07-24 03:12:32

标签: wordpress woocommerce

我需要为付款方式“ cod”禁用电子邮件。处理订单。

如何为此创建代码?

感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

我没有检查处理顺序,但这就是保留订单的代码:

add_filter( 'woocommerce_email_recipient_customer_on_hold_order', 'customer_on_hold_order_for_specified_payment', 10, 2 );

function customer_on_hold_order_for_specified_payment( $recipient, $order ) {
	
   if ( 'wirecard_ee_creditcard' == $order->get_payment_method() ) {
       $recipient = '';
   }
   return $recipient;
}

答案 1 :(得分:-1)

尝试删除待处理订单和保留订单的电子邮件通知。

add_action( 'woocommerce_email', 'unhook_new_order_processing_emails' );
function unhook_new_order_processing_emails( $email_class ) {
   // Processing order emails
   remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
   remove_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
}   

有关更多详细信息,请检查电子邮件挂钩 https://docs.woocommerce.com/document/unhookremove-woocommerce-emails/