How to Display WooCommerce Products Previously Purchased by Current User
If you want to use WooCommerce to display products previously ordered by the current logged in user, you’ve come to the right place! We’ve just released a new version of our bestselling WooCommerce Product Table plugin which lets you show each user a list of products and variations they have previously purchased.
There are lots of reasons to list products that the user has already bought:
- Display purchased products in My Account You may wish to display all products ordered by the current user so they can see everything in one place.
- Quick re-order table List the user’s previous products in a quick one-page order form, so they can quickly find and select items to re-order.
- List favorite products Most customers who make repeat purchases have favorite items that they buy multiple times. Make it easier for existing customers to find and re-purchase their regular products.
Whatever your reasons, keep reading to learn how to use WooCommerce to display purchased items only.
The easy way to display products previously ordered by user
Until now, there were no WordPress plugins that could list products previously bought by the that the current logged in user. You can now do this with our WooCommerce Product Table plugin, which lists any type of products in a searchable table or quick one-page order form:
You can use the plugin to list any or all of your products anywhere on your WordPress site. It has a feature which lets you show products previously ordered by the current user. When you activate this feature, it works like this:
- Depending on how you set it up, customers can either login to their WooCommerce account, or view a dynamic ‘My Previous Products’ page which shows different products depending on the user. The page would include a WooCommerce Product Table listing all products previously ordered by that user.
- If the user has never ordered any products from your WooCommerce store, then they will see a customizable message saying that there are no products in the table.
Why this is different from listing previous orders
The WooCommerce Account page already lists previous orders like this:
As you can see, the default list of orders doesn’t make it easy for customers to repeat an order or re-order products. You can click on an order to view more information. From there, you can click through to the single product page to re-order each product. That’s a lot of clicks if you want to re-order products you have previously purchased! You don’t know which order contains the product you want to re-order. As a result, it’s easy to get lost.
Why WooCommerce Product Table is different
WooCommerce Product Table makes re-ordering much faster and simpler. It automatically lists the products that the current logged in user has previously purchased.
This is different from listing previous orders, because the list isn’t structured by order. Instead, the WooCommerce table displays all products that the customer has ever ordered. It lists each previous product only once, even if the user has ordered it multiple times before.
The user can view the list of products previously ordered, search/sort/filter the list as needed to quickly find what they want to re-order, tick the relevant products and add them to the cart. They can then click through to the WooCommerce cart and checkout as usual.
Next, I’ll tell you how to set it up on your own WordPress WooCommerce website. The lists of previous orders are generated automatically, making it surprisingly easy to set up!
Why it’s different from a WooCommerce Repeat Orders plugin
You might have read about WooCommerce re-order plugins. These simply adds an ‘Order Again’ button to the list of orders in the WooCommerce Account. They’re different from the method described in this tutorial because instead of duplicating a previous order, WooCommerce Product Table displays products previously purchased by the user who is currently logged in.
The customer doesn’t have to remember which order their previous products related to. They just need to use the search, sort and filter functions to quickly find their favorite products. Then, they simply add them to the cart and create a brand new order.
Now you know why you should be letting existing customers re-order from a list of their previous products. Next, we’ll get into the most important part of this tutorial – how to set it up.
How to display products previously ordered by current logged in user
First, I’m going to tell you how to show products previously ordered by the current user on any page. Afterwards, we’ll look at specific places on your site where you might want to display this list. For example, you can add a ‘My Products’ section to the WooCommerce Account page, or create a hidden page that only logged in users can see.
1. Install WooCommerce Product Table
- Get WooCommerce Product Table and install it on your WordPress site (Plugins → Add New).
- Head to WooCommerce → Settings → Products → Product tables.
- Enter and activate your license key.
2. Configure your product table settings
- Choose your columns – When listing previously ordered products, I recommend keeping your columns simple. Just display factual data about each product, such as a thumbnail image, name, and price. Don’t include more general information such as the description, as the user is already familiar with the product. You should almost certainly include an
add-to-cartcolumn because this allows users to re-order the product directly from the list. (Read full instructions)
- Quantity inputs – You should generally tick this box because it allows users to select a quantity before adding it to the cart.
- Add to cart button – If you’re creating a quick re-order form then I generally recommend selecting the ‘Checkbox’ option. This adds multi-select tick boxes instead of standalone add to cart buttons for each product.
- Product variations – It’s generally best to select the ‘Dropdown’ option so that users can choose variations from the list of previously ordered products. Alternatively, choose ‘Separate’ to list each variation on its own row.
- Search filters – If some customers have ordered a large number of products from you, then add some filter dropdowns to make the products easier to find. You can even help customers to find specific products more easily by adding a search box and filters. This is essential for users with a large order history. (Tip: The plugin also comes with filter widgets.) (Read full instructions)
- Lazy load – Since you don’t know how many products each user has previously ordered, there’s a chance that some of them might list large numbers of products. Enable the lazy load option to avoid any performance problems for larger tables.
- Caching – Disable this when listing a user’s previously products. It’s essential to load the list of products separately for each user because a cached version might show other user’s products!
- Search box – Enable this to add a keyword search above the table, helping users to find their favorite products more easily.
- Links – Consider whether or not you want people to be able to click from the list of previous products to the single product page. If not, enter
falsehere to disable the links. This keeps the user on the quick re-order form.
3. Use a shortcode to display previous products
Now, we get to the fun bit! It’s time to list products ordered by the current logged in user. We’ll do this by adding a simple shortcode to any page on your WordPress website:
View the page. If you’re logged in as a user who has previously placed an order, you’ll see all the previously ordered products listed in a neat product table layout:
4. Decide where to put the list of previous products
Now you’ve successfully listed products previously ordered the current user, it’s time to decide how this fits into the overall structure of your website. How will logged in users find their products?
There are three ways to do this:
- Add a ‘My Products’ section to the WooCommerce Account page
- Create a hidden page that only logged in users can see
- Display the products on a public page of your site
I’ll show you how to set up each option.
Option 1: List previously ordered products on the Account page
The WooCommerce account page is the most obvious place to list the user’s previously ordered products. For example, you can add a ‘My Products’ tab to the Account area.
You can easily do this with IconicWP’s WooCommerce Account Pages plugin:
- Install the plugin.
- Go to the list of ‘Pages’ in the WordPress admin and click ‘Quick Edit’ on the page where you added the shortcode to show the logged in user’s previous products.
- Select ‘My Account’ as the parent page and click ‘Update’.
This will add a new link to the list of tabs within the WooCommerce My Account page. The tab will have the same name as the page, for example ‘My Products’. When users log in and click on the link, they will see the list of products they previously purchased:
Option 2: List previously ordered products on a hidden page
Alternatively, you might want to structure the list of previously ordered products outside of the Account area. To do this, you need another method for restricting the page so that only logged in users can see it.
Keeping the page away from the Account area gives you slightly more flexibility. For example, it makes it easier to choose a different page layout and add filter widgets to the sidebar, as you’re not restricted by the layout of the account page.
You can hide the page using the free Restrict User Access plugin:
- Install Restrict User Access on your WordPress site.
- Go to User Access → Add New.
- Click ‘+ New Condition Group’ and select ‘Pages’. Click in the ‘All Pages’ box that appears below.
- Select the page where you’ve added the shortcode to list the current user’s previous products.
- Now go to the ‘Members’ tab and select the ‘Logged-in’ role. (Or, if you prefer, select the ‘Customer’ role so that only logged in customers can see the page.)
- Use the ‘Options’ tab to choose what happens if a guest or logged out user tries to access that page for any reason – for example, because they have bookmarked it.
- Click the blue ‘Create’ button.
Now, only logged in users with the role you selected will be able to access the page where you’ve added the product table shortcode. Each logged in user will only see the products that they have previously purchased.
Add the hidden page to the menu
Of course, your users need an easy way to find the list of products they have previously purchased. You can do this by adding a menu link that only logged in users can see:
- Select the page from the list of Pages on the left, and click ‘Add to Menu’.
- Click on the little arrow in the menu on the right. This will open up extra options for that menu item.
- Use the ‘Access Levels’ option to select which user role(s) can see the menu link.
Option 3: List previous products on a public page
Alternatively, you might want to list previously ordered products for logged in users, and all products for logged out users. For example, this is an excellent option if you want to display each user’s favorite products on the homepage – but you don’t want new customers to see a blank table.
To do this, you need to combine WooCommerce Product Table with another plugin – Advanced Access Manager (AAM). AAM comes with some handy shortcodes that let you display different product tables to guests and logged in users.
To use the two plugins together, simply install them and then paste the following shortcodes onto a page:
[aam show="visitor" hide="customer"] [product_table] [/aam] [aam show="customer" hide="visitor"] [product_table user_products="true"] [/aam]
This conditional statement will list all products for guests, logged out users, and non-customer user roles (e.g. people who have subscribed to your blog but not bought a product). Logged in users will see a table listing the products they have previously ordered.
Can I display order information in the table?
WooCommerce Product Table is all about listing products so that the customer can re-order them. You can display any type of information about the products, such as the image, name, short or long description, price, categories, tags, attributes, and much more. However, it’s not possible to display order information alongside each product, such as the date the product was last ordered.
This is because orders are stored as a separate post type in WooCommerce. Even though you’re listing products previously ordered by the current user, the order information is not stored against these products in the WordPress database.
If the customer wants to access their order history, then they can do this on the WooCommerce Account page. This works nicely alongside the list of previously purchased products.
Can I show previously ordered variations?
When you use WooCommerce Product Table to display products that the user has previously purchased, this includes variable products. If the user previously ordered a product variation, then this product – along with its variations – will appear in the table.
For example, the following screenshot shows what it might look like if the current user had previously ordered 3 variable products. As you can see, all variations for each product (not just the ones that you have previously purchased) are listed as dropdowns next to the add to cart button. The user can select whichever variations they want to buy, and add them to the cart.
In this example, the first and third products have no default variations, so the variation dropdowns are not pre-selected. The second product has a default variation of Black Small, which is selected by default. You can set default variations on the ‘Edit Product’ screen.
Choose which types of product to include
So far, we’ve assumed that you want to list ALL products that the current user has ever ordered. If you prefer, you can have more control over which products to include.
WooCommerce Product Table comes with lots of options for displaying specific products only. In addition to setting it to only show products ordered by the current user, you can choose to list products from a specific category, tag, search keyword, and much more.
For example, you might like to create multiple tables listing items that the user has ordered from specific category. If you sell clothing and jewellery, then the ‘My Products’ page might include one product table listing purchased products from the clothing category; and another product table from the jewellery category. If you stock a wide range of items, then this can be more intuitive for your customers.
Customize the message for users with no previous orders
If a user with no previous orders sees the product table, then they will see a message. By default, it looks like this:
I recommend customizing this message to make it more relevant to previous products. For example:
[product_table user_products="true" no_products_message="You haven't ordered any products yet! Place your first order, and then your products will appear here."]
Use quick view to speed up re-ordering
However, there are situations where you might want to show more information, or if you have too many variations to fit into the product table. If that applies to you, then quick view is the solution.
The WooCommerce Product Table plugin is designed to work alongside its sister plugin, WooCommerce Quick View Pro. Use them together to add quick view buttons to the table. Shoppers click on these to view more product information in a quick view lightbox. Depending on which settings you choose, this might include the full product image gallery, short description, and add to cart options with variation dropdowns.
Review: How Pete Griffith lists his customer’s favorite products
Before we close, let’s look at a real user of WooCommerce Product Table. Pete Griffith uses the plugin to allow regular customers to order their favorite products more easily each week:
Great Plug-in, Awesome Developer.
Where to get the plugin
WooCommerce Product Table is the perfect solution to display specific products based on the logged in user’s past orders.
It makes it much faster for existing customers to login and view a list of products they have previously ordered. They can quickly select the ones they want to re-order, and instantly add their favorite products to the cart.