Custom fields in shop settings

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 2 reply threads
  • Author
    Posts
    • #25637
      pixel effect
      Participant

      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;
      });

    • #25638
      WCFM Forum
      Keymaster

      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

    • #25863
      WCFM Forum
      Keymaster

      Hi,

      Is this works for you?

      Thank You

Viewing 2 reply threads
  • The topic ‘Custom fields in shop settings’ is closed to new replies.