简体   繁体   English

在 Woocommerce 中触发订单自定义状态更改的电子邮件

[英]Trigger email on order custom status change in Woocommerce

I've created a custom email class and added it to WooCommerce.我创建了一个自定义电子邮件类并将其添加到 WooCommerce。 When I go to the emails setting in WooCommerce I can see my template there and when I trigger it manually the email arrives at the target email account.当我转到 WooCommerce 中的电子邮件设置时,我可以在那里看到我的模板,当我手动触发它时,电子邮件会到达目标电子邮件帐户。 Now I have the problem that I've added a action to my class which should detect the order status change and do my trigger function if the order gets set to my custom status:现在我有一个问题,我在我的类中添加了一个动作,它应该检测订单状态的变化并在订单设置为我的自定义状态时执行我的触发功能:

add_action( 'woocommerce_order_status_wc-test-in-progress', array( $this, 'trigger' ), 10, 10 ); add_action( 'woocommerce_order_status_wc-test-in-progress', array( $this, 'trigger' ), 10, 10 );

But when I change the order to this status I don't receive any email.但是当我将订单更改为此状态时,我没有收到任何电子邮件。 Whats wrong here?这里有什么问题?

https://github.com/woocommerce/woocommerce/blob/master/includes/emails/class-wc-email-customer-on-hold-order.php https://github.com/woocommerce/woocommerce/blob/master/includes/emails/class-wc-email-customer-on-hold-order.php

You can checkout this file.你可以签出这个文件。 I've exactly did the same like in this file but replaced all triggers with my custom trigger on order status change.我在这个文件中做了同样的事情,但在订单状态更改时用我的自定义触发器替换了所有触发器。

Wen using woocommerce_order_status_{$status_transition[to]} composite hook, you just need to remove wc- from the status slug like: Wen 使用woocommerce_order_status_{$status_transition[to]}复合钩子,你只需要从状态slug中删除wc- ,如:

add_action( 'woocommerce_order_status_test-in-progress', array( $this, 'trigger' ), 10, 10 );

And it should work.它应该工作。

I have created a new status for orders along with the email template named "reminder".我为订单创建了一个新状态以及名为“提醒”的电子邮件模板。 Now I want that if I change the status of an order from a reminder to processing the processing email should be sent to the customer.现在我希望如果我将订单的状态从提醒更改为处理处理电子邮件应该发送给客户。 It's not sending now.现在不送了。 I think I might have to modify processing email triggers.我想我可能需要修改处理电子邮件触发器。 Any idea how can I achieve this?知道我怎么能做到这一点吗?

暂无
暂无

声明:本站的技术帖子网页,遵循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 中自定义订单状态更改时发送“保留”email - Send "on hold" email on custom order status change in WooCommerce 在交易电子邮件中使用时,Woocommerce 挂钩自定义状态更改不会触发 - Woocommerce hook on custom status change wont trigger when used in trannsactional email Woocommerce自定义订单状态更改日期 - Woocommerce custom order status change date 如何在WooCommerce中使用自定义订单状态更改订单状态 - How to change the order status with a custom order status in WooCommerce WooCommerce订单状态处理然后将电子邮件与客户一起发送到自定义电子邮件 - WooCommerce order status processing then send an email to custom email along with customer 在自定义订单状态更改时更改 Woocommerce 预订状态 - Change Woocommerce booking status on Custom Order Status change 自定义标题和主题 email 通知 WooCommerce 中的自定义订单状态 4 - Custom heading and subject email notification for custom order status in WooCommerce 4 更改WooCommerce订单状态更改而无需发送电子邮件通知 - Change WooCommerce order status change without sending email notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM