Add a new custom Field to Vendor Information

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 4 reply threads
  • Author
    Posts
    • #120970
      AvatarKreator
      Participant

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

      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.
    • #121074
      AvatarKreator
      Participant

      Great, it is working. Can you please let me know where is this store in the DB? Thanks!

    • #121298

      Hi,

      To store verdor/user data wp_usermeta table is used.

      Thanks.

    • #127270
      AvatarKreator
      Participant

      Ok. Thanks. You can close this one.

Viewing 4 reply threads
  • The topic ‘Add a new custom Field to Vendor Information’ is closed to new replies.