How to Add Custom Fields in User Registration in WooCommerce

Sometimes we need to add the extra fields in the WooCommerce registration form to get some more information, which by default you can’t get from the registration page. In this tutorial, I will share how to add custom fields in user registration on the “My Account” page.

There are two ways to add the custom fields in the registration form, first is by creating a custom WordPress plugin by using the below code snippets or secondly you can add below code directly in your functions.php file. By default my account page has only two fields email address & password, see the below screenshot.

WooCommerce My account page

How to Add Custom Fields in User Registration in WooCommerce

Let’s follow the below steps, In this tutorial, I am going to add First name & Last name on the registration form. Add Below code to your functions.php file.

Now add the below code to validate the First name & last name. Copy paste the below code after the above code inside the functions.php file.

Now add the below code inside the functions.php filSave the extra register fields

After adding the above code in your functions.php file, your my account page will look like the below screenshot.

After WooCommerce My account page

Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , ,