Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Membership › How to make fields mandatory (required) in Vendor Registration form
- This topic has 7 replies, 3 voices, and was last updated 5 years, 4 months ago by Gary Funk.
- AuthorPosts
- January 15, 2019 at 3:26 am #43553SamGuest
How can I make some of the built-in field required? such as First Name, store phone etc.? I don’t mind to use the Ultimate version if there is an easier way than coding.
I am not referring to custom fields.Thanks
Sam - January 15, 2019 at 6:43 am #43585WCFM ForumMember
Hi,
Thanks for get in touch with us.
Well, Ultimate not even has option for this.
This can be possible to achieve in two ways –
1. Template Override
2. Custom codingPlease know me which fields you want to set required, I will give you custom code for this.
Thank you
- January 21, 2019 at 4:25 am #44522WCFM ForumMember
HI,
Add this code to your child theme’s functions.php –
add_filter( 'wcfm_membership_registration_fields', function( $registration_fields ) { if( isset( $registration_fields['first_name'] ) ) { $registration_fields['first_name']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $registration_fields['last_name'] ) ) { $registration_fields['last_name']['custom_attributes'] = array( 'required' => 1 ); } return $registration_fields; }, 50 );
Thank You
- January 21, 2019 at 7:23 am #44533WCFM ForumMember
HI,
Install this plugin and add code using this – https://wordpress.org/plugins/code-snippets/
Thank You
- January 22, 2019 at 5:23 am #44642SamGuest
Thank you very much. That did the trick.
However, the code change did not affect Vendor Registration form: https://martezone.com/vendor-register/
can you advise? - September 25, 2019 at 5:10 am #83505Gary FunkParticipant
this is great and works on the vendor registration or for first name and last name however if i try to add State and City to the list of required fieds it does not work?
add_filter( 'wcfm_membership_registration_fields', function( $registration_fields ) { if( isset( $registration_fields['first_name'] ) ) { $registration_fields['first_name']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $registration_fields['last_name'] ) ) { $registration_fields['last_name']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $registration_fields['state'] ) ) { $registration_fields['state']['custom_attributes'] = array( 'required' => 1 ); } if( isset( $registration_fields['city'] ) ) { $registration_fields['city']['custom_attributes'] = array( 'required' => 1 ); } return $registration_fields; }, 50 );
how to make that work?
- AuthorPosts
- The topic ‘How to make fields mandatory (required) in Vendor Registration form’ is closed to new replies.