简体   繁体   English

在 WooCommerce 中自定义订单状态更改时发送“保留”email

[英]Send "on hold" email on custom order status change in WooCommerce

I've created a custom status in Woocommerce Order Page.我在 Woocommerce 订单页面创建了自定义状态。 It seems work.似乎工作。 So I was trying to send the same email of On Hold status, when my custom status is selected like this:所以我试图发送相同的 email 暂停状态,当我的自定义状态被这样选择时:

add_filter( 'woocommerce_email_actions', 'filter_woocommerce_email_actions' );
function filter_woocommerce_email_actions( $actions ){
    $actions[] = 'woocommerce_order_status_wc-attesa-pagamento';
    return $actions;
}

add_action( 'woocommerce_order_status_wc-attesa-pagamento', '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 );
}

add_action( 'woocommerce_order_status_wc-attesa-pagamento', array( WC(), 'send_transactional_email' ), 10, 1 );

But nothing happen?但是什么都没发生? Anyone can help me?任何人都可以帮助我吗?

There is a mistake in your code, you need to replace this line:您的代码中有错误,您需要替换此行:

add_action( 'woocommerce_order_status_wc-attesa-pagamento', 'enable_processing_to_on_hold_notification', 10, 2 );

with this:有了这个:

add_action( 'woocommerce_order_status_attesa-pagamento', 'enable_processing_to_on_hold_notification', 10, 2 );

and it should works.它应该有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Woocommerce 中添加自定义订单状态并发送有关状态更改的电子邮件 - Add custom order status and send email on status change in Woocommerce WooCommerce - 发送自定义订单状态更改的自定义电子邮件 - WooCommerce - send custom email on custom order status change 在 Woocommerce 中触发订单自定义状态更改的电子邮件 - Trigger email on order custom status change in Woocommerce WooCommerce订单状态处理然后将电子邮件与客户一起发送到自定义电子邮件 - WooCommerce order status processing then send an email to custom email along with customer 在Woocommerce中发送具有暂停状态的COD订单的电子邮件通知 - Send email notification for COD orders with on-hold status in Woocommerce 发送订单保留电子邮件,以获取Woocommerce中的特定送货方式 - Send Order On Hold Email for a specific shipping method in Woocommerce 发送有关保留的Woocommerce订单的客户处理订单电子邮件通知 - Send customer processing order email notification for on-hold Woocommerce orders 在 Woocommerce 中自动更改订单状态从暂停到处理 - Auto change order status from hold-on to processing in Woocommerce 在 Woocommerce 中将 COD 默认订单状态更改为“暂停”而不是“正在处理” - Change COD default order status to "On Hold" instead of "Processing" in Woocommerce Woocommerce自定义订单状态更改日期 - Woocommerce custom order status change date
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM