Website Building » WooCommerce » How Do I Custom Sort a Product in WooCommerce?

How Do I Custom Sort a Product in WooCommerce?

Last updated on October 1, 2022 @ 5:33 pm

Sorting products in WooCommerce is easy and can be done in a few clicks. By default, WooCommerce sorts products alphabetically, but you can easily change that by going to the Products tab in the WordPress admin sidebar and clicking on the Sort link. From there, you can choose to sort products by price, date, title, or popularity.

If you want to custom sort your products, then you’ll need to use the [products] shortcode.

This shortcode has a number of attributes that you can use to customize how products are displayed on your WooCommerce store. One of those attributes is ‘orderby’, which allows you to specify how products should be sorted.

The ‘orderby’ attribute takes a few different values:

  • date: Sorts products by their published date.
  • price: Sorts products by their price (ascending or descending).
  • rand: Randomly sorts products.
  • title: Sorts products alphabetically by their title.

So, if you want to custom sort your products by price, then you would use the following shortcode:

[products orderby=”price”]

You can also specify whether you want products sorted in ascending or descending order. To do that, you would use the ‘order’ attribute like this:

PRO TIP: If you are not careful, customizing the sort order of products in WooCommerce can result in products becoming out of stock and unavailable for purchase.
[products orderby=”price” order=”asc”]

[products orderby=”price” order=”desc”]

Conclusion: How Do I Custom Sort a Product in WooCommerce?

Sorting products in WooCommerce is easy and can be done in a few clicks. If you want to custom sort your product, then use the [products] shortcode with the ‘orderby’ attribute.

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.