Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Adding new fields on
- This topic has 7 replies, 2 voices, and was last updated 5 years, 10 months ago by WCFM Forum.
- AuthorPosts
- January 23, 2019 at 9:15 am #44778FuBenduParticipant
Hi
What is the neatest way to have new vendor meta fields (VAT, etc..) appear as custom fields in the vendor Store Settings – Store tab (or even a new tab).
I am using FREE WC Vendors & WCFM Ultimate.
Thank you
- January 23, 2019 at 4:37 pm #44815WCFM ForumMember
HI,
I have created “Website” for registration – https://ibb.co/qBgz9zP
Now, vendors are allow to edit that from WCFM Dashboard -> Profile -> Additional Info -> https://ibb.co/rxwDLvK
Added short code under sidebar widgets – https://ibb.co/fxBcPSn
And visible – https://ibb.co/m8643Wg
Now, problem is this possible using WCFM own multi-vendor module (https://wordpress.org/plugins/wc-multivendor-marketplace/)
Now for WC Vendors will require custom coding.Thank You
- January 24, 2019 at 10:03 am #44933FuBenduParticipant
Thank you for this but I am using WC Vendors and it seems that I cannot access the options you highlight in above menu. Am I missing something? thanks
- January 24, 2019 at 10:14 am #44944FuBenduParticipant
Just to clarify, I already have values stored in user meta fields but I wish these to be seamlessly displayed and made editable on the vendor user settings interface, preferably without touching the WCFM code.
As to how they get used and displayed – that is sorted from my end.
Thanks again
- January 24, 2019 at 2:58 pm #44985WCFM ForumMember
OK, I will give you code snippet for this.
Thank You
- January 25, 2019 at 4:11 am #45083WCFM ForumMember
Hi,
Here is your code -> Add this to your child theme’s functions.php –
add_action( 'end_wcfm_vendor_settings', function( $vendor_id ) { global $WCFM; $wcfm_vendor_website = get_user_meta( $vendor_id, 'wcfm_vendor_website', true ); ?> <!-- collapsible --> <div class="page_collapsible" id="wcfm_settings_form_additional_head"> <label class="fa fa-certificate"></label> <?php _e('Additional Info', 'wc-multivendor-marketplace'); ?><span></span> </div> <div class="wcfm-container"> <div id="wcfm_settings_form_additional_expander" class="wcfm-content"> <h2><?php _e('Additional Setting', 'wc-multivendor-marketplace'); ?></h2> <div class="wcfm_clearfix"></div> <?php $WCFM->wcfm_fields->wcfm_generate_form_field( array( "wcfm_vendor_website" => array( 'label' => __( 'Website', 'wc-multivendor-marketplace'), 'name' => 'wcfm_vendor_website', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $wcfm_vendor_website ), ) ); ?> </div> </div> <?php }, 50, 1 ); add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) { global $WCFM, $_POST; if( isset( $wcfm_settings_form['wcfm_vendor_website'] ) ) { update_user_meta( $vendor_id, 'wcfm_vendor_website', $wcfm_settings_form['wcfm_vendor_website'] ); } }, 50, 2 );
This will create a custom field like this – https://ibb.co/YNqbqQF
Thank You
- January 25, 2019 at 11:38 am #45149FuBenduParticipant
Thank you – worked brilliantly
- January 26, 2019 at 6:36 am #45248WCFM ForumMember
Great … you are welcome 🙂
- AuthorPosts
- The topic ‘Adding new fields on’ is closed to new replies.