Custom user registration fields for WooCommerce: the complete guide
WooCommerce has a built-in registration form that you can use to accept new users on your site. However, depending on your store’s needs, you might want to collect different information from your users. In this tutorial, we’ll look at the default fields plus how to add custom user registration fields for WooCommerce.
We’ll look at the registration form itself in WooCommerce, as well as how to enable registration. Plus, we’ll cover what fields are available by default.
We’ll also look at how to add billing and shipping fields to your registration form, then how to create your own custom fields including upload fields.
This tutorial should be useful for anyone who wants to customise the registration form in WooCommerce, particularly if you’re running certain types of store like wholesale.
What is the WooCommerce registration form?
First off, let’s take a look at what the standard WooCommerce registration form is. By default, when you install and activate WooCommerce, it will automatically create a page called ‘My Account’.
The ‘My Account’ page includes a number of sections where customers can view information about their account and purchases. However, this information is only visible to users once they’ve logged in. So WooCommerce displays a log-in form and registration form to non-logged-in users.
How to enable registration in WooCommerce
To ensure that users can see your registration form, you need to enable the option to ‘Allow customers to create an account on the “My account” page’. Go to WooCommerce > Settings > Accounts & Privacy:
Allowing registration at checkout
Note that WooCommerce has a handy feature allowing customers to automatically create an account during the checkout. You might want to disable this option if you want to collect additional user information through your custom registration fields.
What user fields are displayed by default on the registration form?
You can see from the screenshot of the registration form above that WooCommerce only asks for the user’s email address. You can also require the user to enter their own password and/or choose a username.
To require the user to enter their own password and/or username, go to WooCommerce > Settings > Accounts & Privacy:
- If you want to allow the user to create their own username, enable ‘When creating an account, automatically generate an account username for the customer based on their name, surname or email’
- If you want to allow the user to set their own password, enable ‘When creating an account, automatically generate an account password’
So that covers what you can do with the default user fields in the WooCommerce registration form. Now let’s take a look at how to add some custom fields.
Adding billing and shipping fields to the WooCommerce registration form
WooCommerce has a number of default fields for each user to capture billing and shipping details. These are address fields and other contact details, like phone numbers.
If you’d like to add fields to the registration form, you’ll need the WooCommerce Members Only plugin.
Members Only has a number of features to extend the standard WooCommerce registration form. Let’s take a look at how to add billing or shipping fields to the registration form.
How to add billing and shipping fields to the WooCommerce registration form
Once you’ve installed and activated Members Only, go to WooCommerce > Settings > Members Only > Registration. You’ll find a number of options here to extend the registration capabilities.
Scroll down to the ‘Registration fields’ section. You’ll see a list of all the default billing and shipping fields.
To add one of these fields to your registration form, just check the ‘Enabled’ option next to the field. This will ensure that this field is added to the registration form.
If you’d like to ensure that users have to enter a value in these fields, check the ‘Required’ option.
There are some further options:
- Email: check this if the field should be included on the new user registration email received by the admin
- Profile: check this to add the field and its value to the user profile page
- Priority: you can enter a value here to determine the field’s position in the registration form. The lower the number, the further up the form the field will appear
- Description: enter some extra text here to help the user understand what to enter in the field
You can see in the screenshot below how this might look on the front end.
You can add as many billing and shipping fields to the registration form as you wish.
Creating new custom user registration fields for WooCommerce
Maybe adding billing and shipping fields isn’t enough. Perhaps you want to collect some more specific information about your customers at registration. To do this you can create new custom user registration fields.
As with adding the billing and shipping fields above, we’ll use the WooCommerce Members Only plugin. Go to WooCommerce > Settings > Members Only > Registration and scroll down to the ‘Registration fields’ section.
Under the table showing the billing and shipping fields, you’ll see a ‘Create New Field’ setting.
You can add your custom registration form field using the following settings:
- Enter the field name in the ‘Label’ field
- Choose the field type from the ‘Type’ dropdown
- Check the ‘Enabled’ field to ensure the custom field will appear on the registration form
- If you want to ensure the user completes the field, select the ‘Required’ option
- Select the ‘Email’ field to specify that the field value should be included in the new registration email to the admin
- Check the ‘Profile’ to add the field value to the user’s profile metadata
- Enter a priority to determine the field’s position in the registration form. The lower the priority, the higher up the form the field will appear
- Enter a description to accompany the field on the form
- Click ‘Add Field’ to add the field to the registration form
Your new field will be included at the bottom of the ‘Additional Registration Fields’ setting. You can edit the field from here – or delete it if you no longer require it.
Currently, you can add checkboxes, text fields and upload fields to the registration form.
Custom upload fields on the WooCommerce registration form
You might want to view certain documents from your customers. For example, if you have a B2B store, you might want to see copies of a company’s legal status.
You can add as many upload fields to your registration form as you like. Just choose the ‘Upload’ field when creating the new custom registration field as above.
Add a custom VAT Number field to your registration form
If you’d like to collect your customers’ VAT number at registration, you can just enable the ‘VAT Number’ field in the ‘Additional Registration Fields’. Just check the ‘Enabled’ checkbox to ensure that the VAT Number field appears on your registration form.
Allowing the user to select their user role
You might want to allow the user to specify the user role they should be assigned on registration. This would be particularly relevant if you’re operating a wholesale store where you might want to differentiate between retail and wholesale customers.
To add a role selection field to your registration form, check the ‘Enable Roles Field’ option.
Then, in the ‘Registration Roles’ field, check the ‘Includes’ option next to the roles that you want to allow new users to choose from. If you want to approve new registrations for certain roles, you can check the ‘Needs Approval’ option.
Then, on the front end, you’ll see a select field for the user to choose their role.
You can check out this article to find out how to approve or reject new registrations in WooCommerce
Custom user registration fields WooCommerce: recap
So, in this tutorial, we looked at how to add fields to the WooCommerce user registration form, including the default fields, billing and shipping fields, and custom fields.
To add fields to the registration form, you’ll need the WooCommerce Members Only plugin.