The following code will allow you to enable the use of Advanced Custom Fields (ACF) with the WC Vendors Pro dashboard.
/* - Courtesy of Ben Lumley - * https://www.wcvendors.com/help/topic/howto-add-acf-fields-to-frontend-shop-edit/ * * This will display + save any custom fields applicable to the vendor_shop in question. * Second one displays the fields, you can adjust the action it’s attached to in order * to move the fields (see templates/dashboard/store-settings.php in the pro plugin for * possible actions). You could also split and display different fields in different * places – see the docs for acf_form, you can select single/groups of fields. * http://www.advancedcustomfields.com/resources/acf_form/ * Also possible via acf_form to alter the markup a bit to make it fit your theme. * * This code is not supported by WC Vendors, use at your own risk and at your own discretion. */ add_action('wcvendors_settings_after_shop_name', 'wcv_save_acf_fields'); function wcv_save_acf_fields() { acf_form_head(); } add_action('wcvendors_settings_after_seller_info', 'wcv_add_acf_fields'); function wcv_add_acf_fields() { acf_form( array( 'form' => false, 'return' => false, 'post_id' => 'user_' .get_current_user_id() ) ); } /* * If you have media upload fields (file/image), they won't work, and further, the existing * branding uploaders for icon etc break. This is because acf alters the uploader init to pass a * post_id, and vendor users don't have 'edit_post' capabilities, assume you guys are handling * this somewhere else. This snippet adds a filter in so that if we are trying to 'edit_post' on * our own published vendor store, it will be allowed - restoring media upload. */ add_filter('user_has_cap', 'wcv_vendor_has_cap', 99, 4); function wcv_vendor_has_cap($allcaps, $caps, $args, $user) { if ($args[0] == 'edit_post') { $post = get_post($args[2]); if ($post->post_type == 'vendor_store' && $post->post_author == $user->ID) { $allcaps['edit_published_posts'] = true; } } return $allcaps; }
Reference: https://www.advancedcustomfields.com/resources/acf_form/