The Ultimate Guide to the Woocommerce User Registration Form

In this article, we’re going to take a look at the new customer registration form in Woocomerce, specifically, we’re going to answer some common questions about the form which will hopefully help you to get your registration process working like a well-oiled machine.

As a Customer Do You Have to Register to Buy Products on a Woocommerce Website?

By default, no. After a typical install of Woocomerce customers won’t have to register in order to buy a product from your store. Customers’ will need to enter personal details such as name, address, etc but they won’t be prompted to create an account. If you want to prompt users to register during the checkout process you’ll need to follow these steps.

In the Admin area of your site go to Woocommerce -> Settings -> Accounts & Privacy, from there select the following options

If you set the options as above then a user will automatically be registered when they make their first purchase. If you check the “Allow customers to place orders without an account” checkbox then the user will be asked if they want to register on the checkout screen.

How to Display the Woocommerce Registration Form on the My Account Page

You can show the registration form on the My Account Page by going to Woocommerce -> Settings -> Accounts & Privacy from your websites admin section and checking the “Allow customers to create an account on the ‘My account’ page” option in the “Account creation” section.

How to Stop Woocommerce Sending a User’s Username and Password in the Same Email following Registration

On the “Accounts & Privacy” settings page there are two checkboxes that allow you to specify if a user can supply their own username and password.

These settings can be found in the “Account Creation” section. If you check both of these options then Woocommerce will create a username and password for any users that register. They will then be sent a registration email that contains their sign on details.

This could be seen as a security risk, as anyone who intercepts the email will have access to all the details required to access a user’s account.

If you want to stop these details been sent together the easiest thing to do is to uncheck the “When creating an account, automatically generate an account password” checkbox, the user will be then be prompted to enter a password on registering. As the user is then already aware of their password, the password details will not be included in the registration email.

If a Customer Buys Products as an Unregistered Customer Then Registers at a Later Date Can Their Account Be Linked to Their Already Purchased Products?

The short answer to this question is yes. Before answering this fully I’ll give a bit of background as to how the scenario mentioned in the question could happen.

If a customer makes a number of orders without registering then they will be unable to see their order history. Once the customer registers then they will be able to see order history for any subsequent orders, but how can we marry the two sets of orders together so the customer can see a history of all their orders?

Firstly, in order for this to work the customer in question must have used the same email address for all of their purchases, if they have not done this then Woocommerce will be unable to link the two sets of orders.

If the customer has used the same email address you can attempt to link their orders by going to Woocommerce -> Reports and then choosing the “Customers” tab and then the “Customer list” link.

If you now look at the “Actions” column of the customer list you should see a “Link previous orders” button for any users that have orders that could be linked to their current registered account

Clicking this button should join the two sets of orders together, and the customer in question should be able to access all of their order from the “My Account” screen.

Is it Possible to Automate this Process?

Yes, it is, but you’ll need to add some code in order to automate the process. Skyverge have an excellent article on how to do this.

How Can I See the Email That Woocommerce Sends During the Registration Process in a Dev Environment?

Whilst developing, it can be helpful to see the emails that Woocommerce sends out during the registration process, but it isn’t easy to keep track of emails being sent to different test email addresses.  If you’re using Local by Flywheel to do your local development it has an excellent add-on named “Mailhog” that allows you to see all emails that have been sent. To access MailHog go to the “Utilities” tab in Local and click the “Open Mailhog” link.

Mailhog should then display a list of all the sent emails in your browser window.

How to Receive Notifications to an Admin Account When New Registrations are received in Woocommerce

If you want an email to be sent to an admin user every time a néw registration is completed you can use the snippet below.

add_action( 'woocommerce_created_customer', 'hwn_send_an_email_to_admin_user_when_a_registration_is_received' );

function hwn_send_an_email_to_admin_user_when_a_registration_is_received( $customer_id ) {
  wp_send_new_user_notifications( $customer_id, 'admin' );
}

How this works: The snippet hooks into the ‘woocommerce_created_customer’ action which is fired after a registration has been completed.

We then use the WordPress ‘wp_send_new_user_notifications’ function to send an email to the site’s admin user, the email will list the new user’s username and will look similar to the email below.

The code should be added to your themes ‘functions.php’ file or via a plug-in such as Code Snippets.

Conclusion

Woocommerce provides a number of ways to allow users to register and we’ve hopefully covered some of the major questions about the functionality in this article. If you have any other questions or points please don’t hesitate to do so in the comments below.


Warning: Undefined array key "format" in H:\root\home\bravenewworld101-001\www\hardworkingnerd\wp-content\plugins\convertkit\includes\class-convertkit-resource-forms.php on line 330

Leave a Comment