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:
Result
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.
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 );
Implementation
- Copy WCFM code snippet
- Download the Code Snippets plugin.
- Click on Add new snippet.
- Paste the code that you have copied in step 1.
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:
- Easy to add Vendor category on WCFM Dashboard – Show on the store page
- WCFM Snippet Send Vendor Bank Details to the Customer
- QUIT STEPS IN THE STORE WIZARD SETUP OF WCFM MARKETPLACE
- WooCommerce Subscription with Downloads also add shortcode to the pricing plan
- How to animate shape divider in elementor
- 5 Reasons Why You Should Not Use Nulled WordPress Themes and Plugins
- Debug WordPress, the right way
- Most common HTTP error codes explained and how do you troubleshoot them
- How to change logo color when scrolling in Elementor
- Create animated gradient background with elementor
- Introducing Elementor Blocks for Gutenberg
Check out our categories: Android Update, Elementor, flutter, Guide, Game, Plugin, Theme, webmaster, SEO, Woocommerce, WCFM