WCFM wcfm_marketplace_settings_fields_general not working
-
I am trying to add a vendor store field to get data from vendor.
I am using the below code, please go through the code and let me know what I am going wrong with.
add_filter ( ‘wcfm_marketplace_settings_fields_general’ , ‘add_vendor_vpa’ ,20 );
function add_vendor_vpa($settings_fields_general){$vendor_id = get_current_user_id();
$vendor_data = get_user_meta( $vendor_id, ‘vendor_store_vpa’, true );
$settings_fields_general[‘vendor_vpa’]= array(
‘label’ => __( ‘Virtal Payment address(VPA)/UPI ID’, ‘wc-frontend-manager’ ),
‘type’ => ‘text’,
‘priority’ => 50,
‘class’ => ‘wcfm-text wcfm_ele’,
‘label_class’ => ‘wcfm_title wcfm_ele’,
‘value’ => $vendor_data
);
return $settings_fields_general;
}add_action(“wcfm_vendor_settings_update”, “update_vendor_vpa”, 10, 2);
function update_vendor_vpa($user_id, $wcfm_settings_form){
global $WCFM, $WCFMmp;
if( isset( $wcfm_settings_form[“vendor_vpa”] ) ) {
update_user_meta( $user_id, ‘vendor_store_vpa’, $wcfm_settings_form[“vendor_vpa”] );
} else {
update_user_meta( $user_id, ‘vendor_store_vpa’, “” );
}}
I am getting two fields one in general settings and one in brand setup only with this one code.
When I am trying to save data, an empty string stores in usermeta, not understanding what is wrong with the code.
And also I do not find any developer documentation regarding on how to do this. Please do share a link where I can know more on how to accomplish this.
- The topic ‘WCFM wcfm_marketplace_settings_fields_general not working’ is closed to new replies.