[英]Make On-hold order status notification working in Woocommerce
I need to send a customer email notification when I manually set order status from processing
to on-hold
status.当我手动将订单状态从
processing
状态设置为on-hold
状态时,我需要发送客户电子邮件通知。 I have added the following action hook into my functions.php
file:我在我的
functions.php
文件中添加了以下动作钩子:
add_action( 'woocommerce_order_status_processing_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
Its not working (not showing in WP Mail Log), even though this particular email notification is enabled in woocommerce settings and the similar hook as shown below is working just fine:它不工作(没有显示在 WP 邮件日志中),即使在 woocommerce 设置中启用了这个特定的电子邮件通知,并且如下所示的类似钩子工作得很好:
add_action( 'woocommerce_order_status_pending_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 );
Environment: Woocommerce v.3.5.1 Wordpress v.4.9.9 PHP 5.6环境:Woocommerce v.3.5.1 Wordpress v.4.9.9 PHP 5.6
Any help would be much appreciated.任何帮助将非常感激。
Updated the hook更新了钩子
You should try the following hooked function instead:您应该尝试以下挂钩函数:
add_action( 'woocommerce_order_status_processing_to_on-hold', 'enable_processing_to_on_hold_notification', 10, 2 );
function enable_processing_to_on_hold_notification( $order_id, $order ){
// Getting all WC_emails array objects
$mailer = WC()->mailer()->get_emails();
// Send the "On Hold" notification
$mailer['WC_Email_Customer_On_Hold_Order']->trigger( $order_id );
}
Code goes in function.php file of your active child theme (active theme).代码位于活动子主题(活动主题)的 function.php 文件中。 It should works.
它应该有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.