问题
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