Support

Account

Home Forums General Issues Duplicate user metadata field to custom field – possible? Reply To: Duplicate user metadata field to custom field – possible?

  • 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.