I’m running Woocommerce and the http://www.wcvendors.com plugin, and my vendor shop names are stored in a user meta data field called pv_shop_name. However, I would like these shop names to be automatically stored in custom fields for products belonging to the given vendor – is this possible with ACF? If so, any pointers on how to do this?
Do you want these fields to be visible an editable when the product is edited? If you store them in ACF fields in each product they will be.
I’m guessing that you don’t want the user to be able to edit these fields. In that case you’d need to use standard WP function.
Create a WP save_post filter https://codex.wordpress.org/Plugin_API/Action_Reference/save_post.
Get the pv_shop_name value using get_user_meta() https://codex.wordpress.org/Function_Reference/get_user_meta.
Store the value in the product post using update_post_meta() https://codex.wordpress.org/Function_Reference/update_post_meta
Then display the value on the front end using get_post_meta() https://developer.wordpress.org/reference/functions/get_post_meta/
If you do want these to be ACF fields that can be edited when viewing the post the process would be the same except that instead of update_post_meta() you would use update_field() using the field key of the acf field that you set up of the product page.
Thanks a lot, John! Will look into this.