November 3, 2023

Set the Email as the WooCommerce Account Username with Code Snippets

Play Video

Setting the Email as the WooCommerce Account Username is a feature that can simplify the login process for your customers. This tutorial will show you how to implement this feature using code snippets in WordPress.


Please make sure you have the following installed and activated:

Why Use Email as Username in WooCommerce?

Using an email as a username can make it easier for customers to remember their login credentials. It also streamlines the registration process during checkout.

Setting Up the Code Snippet

  1. Navigate to Snippets > Add New and name it “Email as WooCommerce Username”.
  2. Copy the following code snippet and paste it into the code area.
    add_filter( 'woocommerce_new_customer_data', function( $data ) {
        $data['user_login'] = $data['user_email'];
        return $data;
    } );

    Source: Code Snippets

  3. Save the changes and activate the snippet.

Save the changes and activate the snippet

Testing the Functionality

  1. Go to your WooCommerce checkout page.
  2. Fill in your email address in the email field.
  3. Complete the checkout process.
  4. Log in using your email as the username.

Your email should now serve as your WooCommerce account username.

Supplementary Resources

Set the Email as the WooCommerce Account Username – Conclusion

Setting the email as the WooCommerce account username is a simple yet effective way to improve user experience. By following this tutorial, you’ve streamlined the login and registration process for your customers.

Required Resources

WooCommerce Logo
Free Options
Code Snippets Logo
Free Options
Credit to Web Squadron
Web Squadron is a popular YouTube channel dedicated to providing informative tutorials, tips, and insights on web development and design. With a strong focus on WordPress and website builders like Bricks Builder, the channel aims to help users of all skill levels, from beginners to advanced developers, create and optimize their websites. By offering easy-to-understand, step-by-step guidance, Web Squadron provides practical and valuable content.
Set the Email as the WooCommerce Account Username with Code Snippets
Welcome back!
Enter your Helwp credentials to sign in.

No Account yet? Sign Up

My Account
Give Feedback
Describe your feedback *
Rate Helwp
Problem *
Describe the problem
Want us to reply?
Your E-Mail
Affiliate Disclosure

At Helwp, we’re committed to transparency and honesty. Therefore, we want to inform you that some of the links on our website are affiliate links. This means that, at no additional cost to you, we may earn a small commission if you click through and make a purchase.

We only promote products or services that we genuinely believe in. These affiliate commissions help us to maintain the website and continue to provide you with free, high-quality WordPress content.

If you are interested in how you can support us even further, check out our support page.