[英]Send customer processing order email notification for on-hold Woocommerce orders
If a customer places an order via bacs gateway, the order status is "on-hold" and the customer recieves the accompanying mail-notification with bank details. 如果客户通过bacs网关下订单,则订单状态为“待定”,并且客户会收到随附的带有银行详细信息的邮件通知。 After payment is done, customer receives another email - almost with the same content as before: customer_processing_order
付款完成后,客户会收到另一封电子邮件-内容几乎与以前相同:customer_processing_order
My goal: 我的目标:
Disable the mail for on-hold-orders (this is a default function in the backend) and send the email which is actually meant for paid-orders which carry the status "processing" also in case of an order with (on-hold-status) whilst keeping it also in place for customer-processing-orders. 禁用挂起订单的邮件(这是后端的默认功能),并发送实际用于付费订单的电子邮件,如果订单中包含(挂起-状态),同时也将其保留给客户处理订单。
In other words: New orders with status "on-hold" and "processing" should share the same email-template. 换句话说:状态为“保留”和“处理中”的新订单应共享相同的电子邮件模板。
Is this somehow possible to achieve? 这有可能实现吗?
my rather poor try so far (based on another helpful solution): 到目前为止,我的尝试相当糟糕(基于另一个有用的解决方案):
function unhook_new_order_processing_emails( $email_class ) {
// Turn off pending to processing for now
remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
// Turn it back on but send the on-hold email
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_On_Hold_Order'], 'trigger' ) );
}
Thanks in advance for your help! 在此先感谢您的帮助!
If you have disabled customer "on-hold" email notifications, you can use the following to send an email notification for on-hold orders status using the "processing" email template: 如果您禁用了客户的“保留”电子邮件通知,则可以使用“处理”电子邮件模板,使用以下命令发送有关保留订单状态的电子邮件通知:
add_action('woocommerce_order_status_on-hold', 'email_order_processing_status_for_on_hold', 10, 2 );
function email_order_processing_status_for_on_hold( $order_id, $order ) {
WC()->mailer()->get_emails()['WC_Email_Customer_Processing_Order']->trigger( $order_id );
}
Code goes in function.php file of your active child theme (or active theme). 代码进入您的活动子主题(或活动主题)的function.php文件中。 Tested and works
经过测试和工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.