Save custom post fields value before Woocommerce email send

核能气质少年 提交于 2021-01-29 20:57:30

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/26251858/save-custom-post-fields-value-before-woocommerce-email-send

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!