How to make fields mandatory (required) in Vendor Registration form

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!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Membership How to make fields mandatory (required) in Vendor Registration form

Viewing 5 reply threads
  • Author
    Posts
    • #43553
      Sam
      Guest

      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

    • #43585
      WCFM Forum
      Keymaster

      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 coding

      Please know me which fields you want to set required, I will give you custom code for this.

      Thank you

      • #44517
        Guest
        Guest

        thank you for your response.
        I am trying to make First and Last name required.

        • #44530
          Sam
          Guest

          Super!
          Where would that file be located? sorry, I am a bit of a novice with wordpress.

    • #44522
      WCFM Forum
      Keymaster

      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

    • #44533
      WCFM Forum
      Keymaster

      HI,

      Install this plugin and add code using this – https://wordpress.org/plugins/code-snippets/

      Thank You

    • #44642
      Sam
      Guest

      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?

    • #83505
      Gary Funk
      Participant

      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?

Viewing 5 reply threads
  • The topic ‘How to make fields mandatory (required) in Vendor Registration form’ is closed to new replies.