需要WooCommerce专业知识
我需要为手动创建的订单禁用电子邮件通知,必须使用处理状态,由于处理订单状态存在自定义钩子,因此无法创建自定义状态.
理想情况下,可以在手动订购页面中选中一个复选框,当选中该复选框时,它将禁止在任何状态下都无法向客户发送电子邮件. (处理-已完成).
原因是出于数据库原因,必须将ebay订单输入到后端订单中,我们不希望将已经通过ebay发送的电子邮件重新发送给客户.
我猜想这个钩子需要被调用:
remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );
和这个:
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
解决方法:
我可以看到您在这里没有回覆,不确定您是否设法解决此问题,也不确定要寻找此信息的其他人,请参考此功能:
https://docs.woocommerce.com/document/unhookremove-woocommerce-emails/
在functions.php或自定义插件中:
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' );
function unhook_those_pesky_emails( $email_class ) {
remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) ); // cancels automatic email of order complete status update.
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_New_Order'], 'trigger' ) ); // cancels automatic email of new order placed (when defined to procession status)
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) ); // cancels automatic email of status update to processing.
}