It’s possible to fully customize the registration form on the “My Account” page starting in WooCommerce 2.1.
To begin you must enable the registration:
By default the form is displayed as follows:
Adding new fields
Appears quite modest and without many fields, but we can add additional fields using the actions:
woocommerce_register_form_start– Appears before the “Address Email” field
woocommerce_register_form– Appears after the “Password” field
For example, let’s add “First name”, “Last name”, and “Phone number” fields:
Note that we use fields as
billing_* to be able to associate with the fields customer’s account on WooCommerce later.
Here is the list of all the fields that we can use:
Now the registration form looks like:
Validating the custom fields
It’s very important to validate the fields and make sure that the user is filling them. To do this we will use the
See an example of how to validate our custom fields:
Saving custom fields
Finally we just need to save the custom fields in the database.
We should save that custom fields in user profile and for do this we’ll use the
And voila! All the fields saved and working perfectly 🙂