Recently while working with one of our clients to improve their checkout funnel, we noticed that WooCommerce does not link order made as a guest (non logged-in) with email address which has existing account in WooCommerce.
These orders will be marked as guest orders and will not be linked to the customer account and will not show in their order history on “My Account” section.
Add this snippet to your theme’s functions.php file In order to link guest orders made by registered customers email the the customer account:
Will this work if the guest checkout order is the only order they’ve made and then they register for an account afterwards?
Yes, it should
Love this functionality…thank you for sharing!! I’ve just been doing some testing and this only appears to be working for new orders placed. If a customer has an account and checkouts as a guest using the same email, the order automatically gets the user’s account attached. However, if the user creates an account after placing the guest order, or if the user has an account but placed a guest order prior to this functionality being added, the orders do not automatically attach to the account.
I just tried it and it don’t work if the customer make an order as guest and then create an account.
There is no orders in his account then…
This doesn’t work, I added this to my functions.php and then made a fake guest order and a fake customer order and the orderinfo from the guest order wasn’t added to the customer.
Great Article!
How can I run this on current orders and customers/guests ?
Hi, this will work only for new orders.. you will need to create a custom code to run on all orders to do it for old orders
This is great. As Nitsan is saying, I wish to also add this functionality the other way around.
1. Guest purchases
2. Guest registeres and purchases
And now, both orders are connected to the registered email address.
Do you know what to change in the code to be able to also achieve this?
Our scenario is: The guest user enters the site and places one or more orders without the need to register. And after a while, he decides to register on the site. Now how to Link Guest Orders to Customer Account after registeration?
This works for me but the issue is, since the order is now assigned to a user they can’t view the order confirmation screen. It shows “Please log in to your account to view this order” which is going to be confusing to the user.