Customising the WooCommerce registration form can help you collect the information you need from your customers during sign-up. By adding, removing, or reordering fields, you can align the registration form with your store’s requirements, improving user experience and streamlining processes.
In this guide, we’ll walk you through how to edit the WooCommerce registration form using custom code, without relying on plugins. As always, use a child theme to ensure your changes remain intact after theme updates.
Why Edit the WooCommerce Registration Form?
Editing the registration form allows you to:
- Collect Extra Information: Gather more details about your customers during sign-up (e.g., phone number, date of birth).
- Improve User Experience: Make the registration process clearer and more intuitive.
- Tailor the Experience: Personalise the form based on your store’s needs by removing unnecessary fields.
Step 1: Add Custom Fields to the Registration Form
The following code adds extra fields (e.g., phone number) to the WooCommerce registration form. Add this snippet to your theme’s functions.php file or in a child theme.
/*
* Snippet: How to Edit WooCommerce Registration Form – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1589
* Tested with WooCommerce 10.7.0
* "This function adds custom fields to the WooCommerce registration form"
*/
function wcsuccess_add_registration_fields() {
?>
<p class="form-row form-row-wide">
<label for="reg_phone"><?php _e( 'Phone Number', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="phone" id="reg_phone" value="<?php if ( ! empty( $_POST['phone'] ) ) echo esc_attr( $_POST['phone'] ); ?>" />
</p>
<?php
}
add_action( 'woocommerce_register_form', 'wcsuccess_add_registration_fields' );
How the Code Works
woocommerce_register_formHook: Adds the new field to the registration form.- Field Validation: The input field retains the user’s input if the form fails validation, enhancing the user experience.
Step 2: Save the Custom Field Data
After adding the new fields, you need to ensure that the data entered by the user is saved. Use the following code:
/*
* Snippet: How to Edit WooCommerce Registration Form – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1589
* Tested with WooCommerce 10.7.0
* "This function saves custom registration fields in WooCommerce"
*/
function wcsuccess_save_custom_registration_fields( $customer_id ) {
if ( isset( $_POST['phone'] ) ) {
update_user_meta( $customer_id, 'phone', sanitize_text_field( $_POST['phone'] ) );
}
}
add_action( 'woocommerce_created_customer', 'wcsuccess_save_custom_registration_fields' );
How This Works
woocommerce_created_customerHook: Saves the phone number to the user’s metadata during registration.- Sanitisation: Ensures only clean text is saved to prevent malicious input.
Step 3: Display Custom Fields on the User Account Page
To display the custom field (e.g., phone number) on the My Account page, use the following code:
/*
* Snippet: How to Edit WooCommerce Registration Form – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1589
* Tested with WooCommerce 10.7.0
* "This function displays custom fields on the user account page in WooCommerce"
*/
function wcsuccess_show_custom_user_data( $user ) {
$phone = get_user_meta( $user->ID, 'phone', true );
?>
<h3><?php _e( 'Additional Information', 'woocommerce' ); ?></h3>
<table class="form-table">
<tr>
<th><label for="phone"><?php _e( 'Phone Number', 'woocommerce' ); ?></label></th>
<td><?php echo esc_html( $phone ); ?></td>
</tr>
</table>
<?php
}
add_action( 'show_user_profile', 'wcsuccess_show_custom_user_data' );
add_action( 'edit_user_profile', 'wcsuccess_show_custom_user_data' );
Step 4: Validate Custom Fields
To ensure that the custom fields are filled correctly during registration, you can use the following validation logic:
/*
* Snippet: How to Edit WooCommerce Registration Form – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1589
* Tested with WooCommerce 10.7.0
* "This function validates custom fields on the registration form"
*/
function wcsuccess_validate_custom_registration_fields( $username, $email, $validation_errors ) {
if ( isset( $_POST['phone'] ) && empty( $_POST['phone'] ) ) {
$validation_errors->add( 'phone_error', __( 'Phone number is required.', 'woocommerce' ) );
}
}
add_action( 'woocommerce_register_post', 'wcsuccess_validate_custom_registration_fields', 10, 3 );
How This Works
- Validation: Ensures that the phone number field is not left empty.
- Error Handling: Displays an error message if the required field is missing.
Best Use Cases for Editing the Registration Form
- Collect Extra Data: Gather useful information like phone numbers or addresses during registration.
- Custom Fields for Personalisation: Use fields like “birthday” to offer birthday discounts or personalised promotions.
- Streamlined Registration: Remove unnecessary fields to simplify the registration process, improving conversions.
Conclusion
Editing the WooCommerce registration form gives you greater control over the data you collect and improves the user experience. Whether you want to add new fields, save custom data, or personalise the user journey, these customisations will help tailor the registration process to your store’s needs.
Remember to test your changes in a staging environment before applying them to your live site. Use a child theme to protect your changes from theme updates. For further WooCommerce customisations, explore our WooCommerce Visual Hooks Guide and wp-config generator for additional enhancements.
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

