One of the most asked questions about WooCommerce is how to create an account automatically for customers after completing a purchase.
And is that there is no visible setting in the entire WooCommerce configuration to achieve this, that when a customer makes his first purchase a user account is created automatically.
And I said … visible …
Because it is actually possible. You don’t have to add any code or install any plugin.
For years I’ve read on WooCommerce forums and on the Github repository people asking for this functionality, when in fact it already exists!
Yes, WooCommerce allows you to automatically create an account for customers just by making a purchase, you just need to know what and how to configure it correctly, find the right combination of settings to achieve it, and that’s what I’m going to show you today.
Actually, there are 2 ways to automatically create an account in WooCommerce when a customer makes their first purchase….
Automatically create an account asking for username and/or password
The first way to create an account automatically is with the following settings:
Go to WordPress Desktop → WooCommerce → Settings → Accounts & Privacy. You must configure the settings in this way:
The key settings are to uncheck the “Allow customers to place orders without an account” checkbox in the guest checkout and to check the “Allow customers to create an account at checkout” checkbox.
Whether to allow access to an existing account or not is entirely optional, it would be an additional pre-field.
But it is also almost always unnecessary because if WooCommerce detects the email as existing it will show an error, no matter if you show the above field or not.
Automatically create an account without prompting for username and password
I guess you already know what is the most important setting for WooCommerce to automatically create an account when a customer places an order, right?
Now let’s go a step further and automate everything, even the creation of the username and password.
To do this the settings would be as follows:
Go to WordPress Dashboard → WooCommerce → Settings → Accounts & Privacy. You should configure the settings like this:
At checkout the customer will not be asked for any additional data (username and password) in addition to the usual billing or shipping, but WooCommerce will automatically create a username and password for the customer with the information given.
Also, the customer will receive by email, in addition to the confirmation of his order, another email confirming that his account has been created, with his user name and password.
Is it better to automatically create user and password or not?
Having seen the above, and hopefully already having clear how easy it is to automatically create the user account to your customers when they make their first purchase, the question is whether it is better to create a username and password automatically as in this last example or allow to voluntarily choose their username and password.
Which is better?
If we opt for the customer to choose their username and password:
- Customers often choose bad usernames and worse (insecure) passwords – Bad.
- You ask the customer to fill in more fields in addition to the usual billing/shipping fields – Bad.
- Customers tend to be more aware of their username and password when they choose it themselves – Good
- Customers tend to be more aware that they have created an account when they have to choose a username and password – Good
- Users tend to like choosing their username and password – Good
- WooCommerce automatically logs the customer in – Good
- The customer receives an email from WooCommerce with only their username, no password – Good
If we choose to create everything automatically:
- It is bad practice for WooCommerce to send in the same email username and password – Bad.
- You don’t ask the customer to fill in more fields, besides the usual billing/shipping fields – Good
- WooCommerce automatically connects the customer – Good
- The customer will have an email with their login details that they can save and retrieve – Good
- Automatically generated passwords will always be better (usually) than the ones the customer chooses – Good
Having said all this, I think that, analyzing pros and cons, what do you think would be the best option, taking into account security?
The best and safest way to create an account automatically when the customer places his first order
With all of the above, I think the perfect setup for automatically creating accounts for customers on their first order would be to ask the customer to choose a username and password.
The downside is that the customer has to fill in more data to complete their order (username and password), but considering security, a factor that I consider decisive, the fact that users choose insecure passwords is partly remedied thanks to the WordPress/WooCommerce password strength check, if you have not removed it.
On the other hand, you avoid that in the confirmation email that the account has been created go together username and password, as only the chosen username will be reported.
The result would be that:
- The customer can choose his username, his dose of personalization.
- The customer can choose a password, and WooCommerce forces it to be secure.
- WooCommerce automatically logs the user in.
- The customer gets confirmation that their account has been created, just with their username.
- Of course, the account is created automatically.
Yes, you will say that I contradict myself because I always insist on facilitating payment so as not to unnecessarily lengthen the sales funnel, but security is (or should be) always a priority over everything else.