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.
Prerequisites
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
- Navigate to
Snippets > Add New
and name it “Email as WooCommerce Username”. - 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
- Save the changes and activate the snippet.
Testing the Functionality
- Go to your WooCommerce checkout page.
- Fill in your email address in the email field.
- Complete the checkout process.
- 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.