Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Marketplace › Custom fields in shop settings
- This topic has 2 replies, 2 voices, and was last updated 5 years, 9 months ago by WCFM Forum.
- AuthorPosts
- June 29, 2018 at 5:21 am #25637pixel effectParticipant
I’d like to add a custom field into the shop settings.
The view worked with the following code.
But saving does not go well.add_filter( ‘wcfm_wcmarketplace_settings_fields_general’, function($setting_fields){
$meta_val = get_user_meta(get_current_user_id(), ‘_vendor_sample_meta_key’, TRUE) ? get_user_meta(get_current_user_id(), ‘_vendor_sample_meta_key’, TRUE) : ”;
$setting_fields[‘_vendor_sample_meta_key’] = [
‘label’ => __(‘Sample’, ‘sample-plugin’),
‘type’ => ‘text’,
‘class’ => ‘wcfm-text wcfm_ele’,
‘label_class’ => ‘wcfm_title wcfm_ele’,
‘prwidth’ => 150,
‘value’ => $meta_val,
‘hints’ => __( ‘Sample’, ‘sample-plugin’ )
];
return $setting_fields;
}); - June 29, 2018 at 10:02 am #25638WCFM ForumKeymaster
Hi,
Thanks for get in touch with us.
That’s great to see that you have added a custom filed at setting page, that’s perfect.
You just missed the save code for the field. Here is that for you –
function wcfm_wcmarketplace_settings_custom_update( $vendor_id, $wcfm_settings_form ) { if( isset( $wcfm_settings_form['_vendor_sample_meta_key'] ) ) { update_user_meta( $vendor_id, '_vendor_sample_meta_key', $wcfm_settings_form['_vendor_sample_meta_key'] ); } } add_action( 'wcfm_wcmarketplace_settings_update', 'wcfm_wcmarketplace_settings_custom_update', 10, 2 );
Thank You
- July 4, 2018 at 11:15 am #25863WCFM ForumKeymaster
Hi,
Is this works for you?
Thank You
- AuthorPosts
- The topic ‘Custom fields in shop settings’ is closed to new replies.