Home Forums Backend Issues (wp-admin) ACF field on WC Order not saved before email sent


ACF field on WC Order not saved before email sent

  • Hi. I’m using ACF Pro to add a delivery tracking URL to a WooCommerce order. This field gets included in the ‘order complete’ email sent to the customer. This works okay if the user puts in the tracking URL, saves the order, then marks the order as complete. However, if they add the tracking URL and mark the order as complete in one edit, it seems like the email is sent before the ACF field is saved and it’s therefore blank in the email.

    Is there any way I can force the ACF field to update earlier in the save, before the email is sent?

  • If WC is sending the email before ACF saves the field, unfortunately, you will not be able to use get_field() to get ACF values. Instead you will need to use $_POST['acf'][ACF FIELD KEY] to get the values.

  • That worked. Thanks John. 👍

  • Thanks, this helped me as well.
    I was going crazy trying to figure out why my preview emails plugin was showing the data but the emails weren’t.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.