Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Marketplace (WooCommerce Multivendor Marketplace) › Add a new custom Field to Vendor Information
- This topic has 4 replies, 2 voices, and was last updated 4 years, 7 months ago by Kreator.
- AuthorPosts
- April 20, 2020 at 5:34 pm #120970KreatorParticipant
Hi,
I want to add a custom field stored in the database that will contain an URL that I will be manually assigned and will be specific to each vendor.
I want to be displayed it in the Vendor List after clicking the “+” (More Info) icon.
Screenshot attached.
Thanks!
Attachments:
You must be logged in to view attached files. - April 20, 2020 at 8:11 pm #121044Sarmistha ChakrabortyMember
Hello,
To add custom field in vendor store settings,and save to database, try this code in your theme’s functions.php
add_filter('wcfm_marketplace_settings_fields_general', 'wcfm_marketplace_settings_fields_general_custom2004', 50, 2 ); function wcfm_marketplace_settings_fields_general_custom2004($general_fields,$vendor_id) { $vendor_data = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); $store_externalurl = isset( $vendor_data['store_externalurl'] ) ? esc_attr( $vendor_data['store_externalurl'] ) : ''; if(isset($general_fields['store_name'])) { $general_fields['store_externalurl']= array('label' => __('Store External URl', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $store_externalurl ); } return $general_fields; } add_action( 'wcfm_wcfmmp_settings_update','fn_wcfm_vendor_settings_storetype_update2004', 50, 2); add_action( 'wcfm_vendor_settings_update','fn_wcfm_vendor_settings_storetype_update2004', 50, 2); function fn_wcfm_vendor_settings_storetype_update2004($user_id, $wcfm_settings_form ){ $wcfm_settings_form_data_new = array(); parse_str($_POST['wcfm_settings_form'], $wcfm_settings_form_data_new); $wcfm_settings_form_data_storetype = array(); if(isset($wcfm_settings_form_data_new['store_externalurl']) && !empty($wcfm_settings_form_data_new['store_externalurl'])) { $wcfm_settings_form_data_storetype['store_externalurl'] = $wcfm_settings_form_data_new['store_externalurl']; } $wcfm_settings_form = array_merge( $wcfm_settings_form, $wcfm_settings_form_data_storetype ); update_user_meta( $user_id, 'wcfmmp_profile_settings', $wcfm_settings_form ); }
I want to be displayed it in the Vendor List after clicking the “+” (More Info) icon.
>>Sorry this point is not clear, when you add the field, you will find the field in each store details (PFA)Thanks.
Attachments:
You must be logged in to view attached files. - April 20, 2020 at 9:50 pm #121074KreatorParticipant
Great, it is working. Can you please let me know where is this store in the DB? Thanks!
- April 21, 2020 at 3:06 pm #121298Sarmistha ChakrabortyMember
Hi,
To store verdor/user data wp_usermeta table is used.
Thanks.
- May 6, 2020 at 11:09 am #127270KreatorParticipant
Ok. Thanks. You can close this one.
- AuthorPosts
- The topic ‘Add a new custom Field to Vendor Information’ is closed to new replies.