I have added a ACF field to my member registration page and trying to get it to save. The field name is ‘prescription’ and it’s an image field.
In my save hook, I added the following but nothing happens:
if ( isset( $_POST['acf']['field_582e2b81527b6'] ) ) {
update_user_meta( $customer_id, '_prescription', $_POST['acf']['field_582e2b81527b6']);
}
I should also add, this is specidially for WooCommerce. I have hooked into the ‘woocommerce_created_customer’ event in order to save the fields. I am saving other WooCommerce specific user_meta fields, and that works fine. It’s just not saving the ACF field.
Thanks.
Hi @louiswalch
Could you please make sure that $_POST['acf']['field_582e2b81527b6']
has the correct value? If it’s, then you can update the field like this:
update_field('field_582e2b81527b6', $_POST['acf']['field_582e2b81527b6'], 'user_' . $customer_id);
This page should give you more idea about it: https://www.advancedcustomfields.com/resources/update_field/.
I hope this helps 🙂