简体   繁体   English

使暂停订单状态通知在 Woocommerce 中工作

[英]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.

相关问题 在Woocommerce中发送具有暂停状态的COD订单的电子邮件通知 - Send email notification for COD orders with on-hold status in Woocommerce 在 Woocommerce 中获取客户“暂停”订单状态总金额 - Get customer "on-hold" order status total amount in Woocommerce 发送有关保留的Woocommerce订单的客户处理订单电子邮件通知 - Send customer processing order email notification for on-hold Woocommerce orders 向管理员发送暂停订单状态 email 通知 - Send on-hold order status email notification to admin 在 Woocommerce 3.3 中下订单后向客户发送暂停订单通知 - Send customer on-hold order notification once order is placed in Woocommerce 3.3 更改 WooCommerce 中没有特定产品的“暂停”订单的订单状态 - Change order status for “on-hold” orders that doesn't have a specific product in WooCommerce 从 WooCommerce“暂停订单”和“新订单”电子邮件中删除订单编号 - Remove Order # from WooCommerce “Order on-hold” & “New Order” Emails 自动将 Woocommerce 订阅状态​​更改为“暂停”而不是“活动” - Auto change Woocommerce Subscriptions status to “On-Hold” rather than “Active” WooCommerce:当状态为搁置时,允许用户访问可下载的文件 - WooCommerce: give user access to downloadable files when the status is on-hold 将 WooCommerce “暂停”订单更改为特定产品的自定义状态 - Change WooCommerce “on-hold” orders to a custom status for specific products
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM