Search code examples
wordpresswoocommerceaccount

Prevent generating username from firstname and lastname in Woocommerce


I'm trying to modify Wordpress (with Woocommerce) to prevent generating username from concatenating firstname and lastname in the Woocommerce account registration. I'm not sure if the issue is with Woocommerce 'cause I can't find the correct hook for it for wordpress.

Basically the issue is, for example, a customer is registered with the following:

Firstname: John Lastname: Doe Username: doejohn Email: johndoe@test.com

Now when another customer comes and registers with the name John Doe but with a different email address, say jd123@gmail.com, he will be unable to do so because there exists a username doejohn in the database.

I'm not sure if this is a Wordpress or Woocommerce default functionality but I would like to allow customers with same names to register.

Any help would really be appreciated. Thanks!


Solution

  • In Woocommerce settings > Account and privacy, you can enable the option "When creating an account, automatically generate a username from the customer's email address".

    enter image description here