Make mandatory the first name and last name – WCFM registration

Code Snippet Overview:

The WCFM registration code snippet that Makes mandatory the First Name and Last Name fields in the registration form is great when the admin of the website wants to get the complete name of the store owner. When you install the WCFM plugin of WCLovers the registration fields that appear in the registration form are optional:

Make mandatory the name in registration - WCFM Code snippet


Now, after you add the code snippet the seller will be forced to complete the name and surname fields to be able to register in your website.

Make mandatory the name and last name - WCFM registration Code snippet

Code Snippet

//WCFM registration code snippet to make mandatory the name field 
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 );


  1. Copy WCFM code snippet
  2. Download the Code Snippets plugin.
  3. Click on Add new snippet.
  4. Paste the code that you have copied in step 1.
Add custom field in store details - WCFM Code snippet

More WCFM code snippets for the Settings panel

You have your vendor insider your site, so, why not make smoother the product creation? You can check this code snippet if you want to show the product categories as a conditional dropdown list to make it easier for the vendors to select them:

Another post: 



Check out our categories: Android Update, Elementor, flutter, Guide, Game, Plugin, Theme, webmaster, SEO, Woocommerce, WCFM




Share This Article:

My Orders

My Downloads

My Booked Services

My Subscriptions