在发送Woocommerce电子邮件之前保存自定义帖子字段的值 [英] Save custom post fields value before Woocommerce email send

查看:159
本文介绍了在发送Woocommerce电子邮件之前保存自定义帖子字段的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Woocommerce发送的电子邮件有疑问.

我有多个使用ACF插件设置的自定义字段,用于Wooocomerce订单.这些字段包含其他信息,这些信息应该在发送给用户的电子邮件中可见.

但是由于某些原因,在发送电子邮件之前我无法保存它们,因此电子邮件没有这些值.只有在我单击重新发送电子邮件后,这些值才可见.

我尝试使用对挂钩进行优先级来对操作挂钩进行优先级排序,但是没有用.尝试了多项操作以便确定优先级.

我在使用的模板中设置了Woocommerce电子邮件,并检索了如下自定义字段:

$ fields = get_field('fields',$ customer_order-> ID);

如何使它正常工作?任何帮助表示赞赏.

解决方案

在发送电子邮件之前,您需要存储数据,因此需要找到正确的钩子.如果我没看错,before_woocommerce_pay钩子是您的答案在此处检查以获得更多woocommerce钩子

I have an issue regarding emails sent by Woocommerce.

I have multiple custom fields, set up using the ACF plugin, for Wooocomerce orders. These fields contain additional info that should be visible in the emails sent to the user.

But for some reason I can't get them to save before the email is send and thus the email is empty of those values. Only after I click resend email are the values visible.

I tried prioritizing the action hooks using the Prioritize Hooks plugin but to no avail. Tried multiple things in order to prioritize.

I have the Woocommerce emails set up in the template that I use and get retrieve the custom fields like this:

$fields = get_field('fields', $customer_order->ID);

How can I get this to work properly? Any help is appreciated.

解决方案

you need to store your data before send the email, so you need to find the correct hook. If i'm not wrong the before_woocommerce_pay hook is your answer check here for more woocommerce hooks

这篇关于在发送Woocommerce电子邮件之前保存自定义帖子字段的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆