WooCommerce gives store owners some basic product sort options such as popularity, average rating, latest, price, etc. These work pretty well but the problem is that if you want to sort order products by custom field then it doesn’t allow you to do so.
So, we need to use custom code to sort order products by the custom field which can be very difficult for someone with non-technical experience. But don’t worry, I got you covered here!
In today’s article, I’ll show you how to sort order products by custom field using the WooCommerce Product Table plugin. WooCommerce Product Table plugin lets you list the products in an intuitive, user-friendly table layout with multiple columns of information.
On This Page
How to Sort Order of Products by Custom Field?
Here I’ll show you the step-by-step process to sort order products by custom field in Woocommerce. I’ll be using the WooCommerce Product Table plugin to sort orders.
This plugin lets you list products in a user-friendly table/list layout with multiple columns of information.
Note: I am assuming that you have already created and utilized custom fields. If you haven’t you will need to create some custom fields with the help of a plugin like ACF or custom code it in your theme, to follow along with the tutorial.
I have created a “Brand” custom field and I’ll be using this field as the sort order. So follow the following steps to sort the order of products by custom fields in WooCommerce.
1. Install and Activate the WooCommerce Product Table Plugin
Note: You can skip this step if you have already installed and activated the WooCommerce Product Table plugin.
To install the WooCommerce Product Table plugin, you will need to install the Woosuite Core plugin and activate it with the help of a license key. We have created a Quick Start Guide for you to figure out how to install and activate the WooCommerce Product Table plugin.
2. Create a New Table
Once you have installed and activated the plugin, Now to sort the order of products by custom field in WooCommerce, you need to create a product table that will display all of your products in a table and improve the layout.
Follow the given steps to create a standard table.
Note: This tutorial is only focused on sorting the order of products in WooCommerce by a custom field so I won’t show you to create an advanced table layout but you can follow the create a table layout tutorial to learn this.
2.1. Add New Table
To create a table, navigate to Woosuite » Product Table from your WordPress dashboard and click on the Add New Table button.
Once you click it, you’ll see a screen where you can create and control the different table settings.
2.2. Order Form Display
Give an internal name to the table. This will help identify and manage the tables if you are working with multiple tables at a time.
2.3. Order Form Information
Now expand the Order Form Information by clicking on the (▾)
Now, specify the columns you want to add to the table. To add a column just drag the column from the Available columns section and drop it in the selected columns sections.
2.4. Set the Custom Field
To set the custom column, click on the pencil icon on the column name.
Once you’ll click on the pencil icon, a pop-up will appear. Now, from the Data Source dropdown, select Post Meta.
Now, in the Meta Key field, enter the custom field name, you created with the Advanced Custom Fields plugin and click on the Update plugin.
3. Sort the Order of Products by the Custom Field
Now expand the Order Form Controls by clicking on the (▾)
Now from the “Sort Products By” dropdown, You can select how you want to sort the products in the table. This will let you set the initial sort order that’ll be applied to the product table layout.
You can choose from the following options using the dropdown:
- As listed in the Products screen (menu order)
- Number of sales
- Average reviews
- Date added
- Date last modified
The ‘Other’ option lets you sort products by any column in the table. Keep in mind that this only works if the lazy load is disabled.
As we have created the “Brand” as the custom field so to add a custom field sort order, add cf:custom_field_name, i.e; cf:brand
4. Change the Sort Direction
Once that’s done, use the Sort direction dropdown to select the sort direction. You can choose:
- Ascending (A to Z, 1 to 99)
- Descending (Z to A, 99 to 1)
I have selected “Automatic” from the dropdown.
5. Save the Changes
Once that’s done, now click on the Save Changes button at the top right corner to save the changes.
6. Final Results
Now if you visit the shop page of your store, you’ll see all the products are being displayed in a table layout and are sorted by the brand.
That’s it, now you know how to sort orders of products by a custom field in WooCommerce without using any custom code.
The WooCommerce plugin comes with some basic product sorting options.
But with the help of the WooCommerce Product Table plugin, You can set the initial sort order and let customers sort products in a variety of ways. You’ll also be able to customize the sorting options on a global or per-category basis.
If you have any queries, you can ask them in the comments or contact our customer support. Our dedicated customer support team typically replies within 48 hours.
Ready to sort products on your WooCommerce store, increase product visibility, and boost sales? Get the WooCommerce Product Table plugin today!