sort woocommerce products

How to Sort WooCommerce Products

Reordering products allow users to filter results according to their liking and it is an excellent way to improve product visibility and conversions. In this article, we will show you different methods to sort WooCommerce products

Why Sort Products in WooCommerce?

Depending on your store, you can have hundreds or thousands of products. If that’s the case and you don’t have a good search system, it might be difficult for your customers to find their desired items. This can make it harder for them to find what they’re looking for and affect your revenue.

To fix this problem, you can offer numerous sorting features. By adding sorting options (or tweaking the default ones), you can improve the overall shopping experience in your store. For example, you can let your customers quickly get results based on the average sales, product popularity, or even product prices.

Having multiple sorting options can help shoppers find the desired product faster and more efficiently. As a result, sorting products can be very beneficial to your eCommerce store.

Now that we better understand why having options to reorder products can benefit your store, let’s see how to do that properly.

How to Sort WooCommerce Products

There are three main methods to sort WooCommerce products:

  1. Using the WordPress Customizer
  2. With a WordPress plugin
  3. Through custom snippet (programmatically)

We will take a look at all three methods below so that you can find your preferred way to complete the task. 

Before we start, make sure you have properly set up WooCommerce on your website without missing any steps. This will ensure that all these methods will work smoothly.

1) Sort WooCommerce Products using the WordPress Customizer

Changing the default sorting option is one of the easiest things you can do to sort products in WooCommerce. You can find this option on the shop page or any page of your store with a product catalog.

default sorting label sort woocommerce products

You can edit the default options just by using the WordPress customizer included in WooCommerce.

Go to Appearance > Customize to open the theme customizer and choose the WooComemrce option.

woocommerce customizer

Then, select Product Catalog and you will see the default WooCommerce product sorting options for the shop page. 

woocommerce default sorting

When you click on it, a drop-down menu will appear showing you the six default product sorting options.

  • Default
  • Popularity (sales)
  • Average rating
  • Recent
  • Price (ascending)
  • Price (descending)

sorting options sort woocommerce products

Select the default sort option that suits your store and finally publish the saved changes after you select the desired option.

This is how you can modify the WooCommerce product sort through the WordPress dashboard. The main advantage of this method is that it doesn’t require any plugins, technical knowledge, or custom snippets.

However, there are some disadvantages too. The default sorting option is minimal and may be very limited in some cases. So if you want more options, have a look at the following methods.

2) Sort WooCommerce Products with a Plugin

If you are ready to use some WordPress plugins to sort the WooCommerce products, you can check out Rearrange Woocommerce Products or WooCommerce Extra Product Sorting Options. They are both excellent plugins for you and your customers to sort products in your online store. 

For this tutorial, we will be using WooCommerce Extra Product Sorting Options. So, the first thing you need to do is install and activate the plugin on your WooCommerce site.

install WooCommerce Extra Product Sorting Options

Once you have activated the plugin, you can use the WordPress customizer for tweaking it. Once again, go to Appearance > Customize from your WordPress dashboard and select the WooCommerce option just like the previous approach. Now, select the Product Catalog section and you will get some additional sorting options.

sort woocommerce products - additional sorting

As you can see in the screenshot, the additional options that you get are:

  • Editing the default sorting label
  • Adding new product sorting
  • Removing existing product sorting

By default, WooCommerce will display the “Default Sorting” label when someone visits your shop archive. But with this plugin, you can rename it from the customizer itself if needed.

Just enter the New Default Sorting Label that you want for the product catalog in the textbox.

new sorting label sort woocommerce products

You will be able to see the preview on the right side of your screen instantly. The changes will be applied to the front end after you publish the saved changes.

default sorting rebranded

Apart from changing the label, you can also add or remove product sorting options.

To add the product sorting options, just check the sorting options that you would like to provide to your customers.

add new sorting option sort woocommerce products

Once you select the options, they will be displayed in the preview automatically.

new sorting options added

Just like adding the product sort options, you can also remove the existing ones. This can be a great feature for your online store if you have a lot of additional unnecessary sorting options. And depending on your website and products, some customers may be overwhelmed with the vast number of sorting options too.

You can easily remove those sorting options using the plugin. To remove them, just check the options that you want to remove from your website. 

remove product sorting sort woocommerce products

If you look at the preview, you will be able to see that the additional sorting options are now shown on the dropdown menu for sorting.

default options removed

Again, don’t forget to publish it after you have made all the necessary changes.

That’s it! You can now use a dedicated WordPress plugin for sorting the WooCommerce products.

3) Sort WooCommerce Products Programmatically

If you need the most advanced method, the programmatical approach can be the best fit for you. You can modify the sorting option just by placing a simple PHP snippet in your site-specific plugin or the theme’s functions.php file.

For this, you can use a dedicated plugin like Code Snippets for adding the custom codes to your WooCommerce site or create a child theme. If you need help, you can even use one of the child theme plugins for WordPress to create one. But make sure that you back up your WordPress website before we start since we will be modifying some core files of your website.

However, we will go with Code Snippets in this demonstration. So first, install and activate this plugin on your site.

install code snippets

After the activation, you can see the plugin’s settings on the left-hand side of your screen. Just go to Snippets > All Snippets from your WordPress dashboard. 

all snippets

Then, click on Add New to add a new snippet to the WooCommerce installation.

add new snippet

Now, copy the following code and paste it inside the snippet field. Also, don’t forget to name the snippet so that you can identify them for future updates.

add_filter('woocommerce_default_catalog_orderby', 'quadlayers_default_catalog_orderby');

function quadlayers_default_catalog_orderby( $sort_by ) {
return 'date';

woocommerce sorting script sort woocommerce products

If you look at the code, we have added date as the primary sorting option. But, you can always modify it according to your liking. The available options are:

  • menu_order – the default one
  • popularity – according to the sales
  • rating – by customer rating
  • date – according to the published date
  • price – price low to high sorting
  • price-desc – price high to low
  • rand – random products every time

For example, if you need to sort the products according to the customer rating, you should modify the code like this:

add_filter('woocommerce_default_catalog_orderby', 'quadlayers_default_catalog_orderby');

function quadlayers_default_catalog_orderby( $sort_by ) {
return 'rating';

Once you have modified the code, publish the snippet. Now, check your shop page, and you will see the new sorting option by default. In this case, it’s sorted with average sorting as shown in the screenshot below.

sort by rating

But you can always tweak the code according to your requirements. 

Reorder Products from the Products List

We’ve already established that you can sort WooCommerce products by default from the WordPress Customizer. However, you can also reorder individual products manually using the WooCommerce plugin itself. The products can even be sorted in a random order as default sorting for the customers.

And the best part is that you do not even need to use additional plugins or custom codes for the task. Everything can be reordered just from the dashboard.

So, the first thing you need to do is go to Products > All Products from your WordPress dashboard. You will be able to see it on the left-hand side of your screen.

sort woocommerce products - woocommerce products

On the next page, you can see all the published products. If you take a close look at the page, you will also see an option called Sorting.

sort woocommerce products - woocommerce sorting

If you select that option, and you will be redirected to the product sorting wizard.

By default, WooCommerce will sort the products according to the published date. But through this page, you can easily rearrange using drag and drop. 

sort woocommerce products - woocommerce default sorting

You can easily drag products and drop them in the desired position, as shown above. Once you have done that, check the product archive page from the front-end.

products sorted

This way, you can sort WooCommerce products manually in any order without any additional plugins or codes.

Reorder Specific Products 

When you apply some sorting option globally on your WooCommerce installation, it will reflect site-wide. However, that’s not a good option if you need to reorder specific products.

Let’s say you may need to display a custom product on top of the archive or shop page. Then, you will have to look for a different approach to sort the WooCommerce products. Thankfully, it can be done by just using the product editor in WooCommerce.

The first thing you need to do is open the product editing wizard. Once again, go to Products > All Products from your WordPress dashboard and click on Edit for the product that you want to reorder.

edit product sort woocommerce products

Then, you will be redirected to the product editor page. Here, scroll down under the product data and click on the Advanced tab.

advanced tab

WooCommerce will choose the menu order according to your product published queue by default. So, when you have published your 10th product inside the shop, the menu order will be 10. Just like that, after publishing your 25th product, WooCommerce will set its menu order as 25.

But from the advanced tab, you can always modify it. And that’s what we are going to do to reorder the products.

To bring the specific product to the top of the archive page, use 0 or a minus (-) value. For example, you can use 0 or -1 to bring the product to the top page. In this demo, we will make the menu order as -1. Finally, Update the product once you have modified the value.

new menu order

After that, check your archive page from the front end.

menu order changed

As you can see in the above screenshot, we have quickly brought the specific product to the top of the page. Even though if you use -2 on another product, it will be ranked first.

You can use the previous method from the product lists for it too. But this is a more direct approach since we can place the product in a more specific position through the menu order.

Sort Products of a Specific Category

To keep the products handy and accessible to everyone, you can also use categories to sort WooCommerce products. And with a simple snippet, you can add a custom sorting feature to a category archive. This section will tell you more about it.

Make sure that you have got enough product categories in your WooCommerce store. But on our demo website, all we have is an uncategorized category and six products assigned to it.

product category

As you can see, the slug is uncategorized. We will be using this slug later in the snippet. Next, go to the Code Snippets plugin and create a new snippet. Once you have done that, copy and paste this code from below to your website.

add_filter('woocommerce_default_catalog_orderby', 'quadlayers_catalog_orderby_for_category');

function quadlayers_catalog_orderby_for_category( $sort_by ) {
if( !is_product_category('uncategorized') ) {
return $sort_by; // modify uncategorized category archive sorting
return 'date';

category sorting

If you look at the code, you can see that we have selected the “uncategorized” slug inside the code and used the date filter for sorting. Before publishing the code on your website, replace it with your category slug and sort option.

Once you have done that, publish the snippet.

When you visit the specific category archive, you will see the new sort option by default. In our case, the products are automatically sorted by the latest date.

sort by latest filtering

That’s it! This is how you can sort products of a specific category.

Bonus: Sort WooCommerce Products Alphabetically

If you have a lot of products, sorting them alphabetically would be a great idea. In fact, alphabetical order is one of the most ideal ways of sorting in any type of list. If you look at your files on your computer, even they are sorted alphabetically by default.

Similarly, it can be very convenient for your new customers as well. They can easily find the product they want in your store by just filtering through the letters of the product alphabetically. 

So in this section, we will show you how to sort WooCommerce products alphabetically with a simple snippet. The code you need to use is as follows:

function quadlayers_alphabetical_shop_ordering( $sort_args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'alphabetical' == $orderby_value ) {
$sort_args['orderby'] = 'title';
$sort_args['order'] = 'asc';
$sort_args['meta_key'] = '';
return $sort_args;
add_filter( 'woocommerce_get_catalog_ordering_args', 'quadlayers_alphabetical_shop_ordering' );

Just add this to the Code Snippet plugin or the functions.php file on your website.

alphabetical sorting

After pasting, publish it. Now, we have completed the heavy job. The next thing we need to do is, create a label so that the visitors can use the sorting option. To do that, you need the following code:

function quadlayers_custom_wc_catalog_orderby( $sortby ) {
$sortby['alphabetical'] = 'Sort by Name: Alphabetical';
return $sortby;
add_filter( 'woocommerce_default_catalog_orderby_options', 'quadlayers_custom_wc_catalog_orderby' );
add_filter( 'woocommerce_catalog_orderby', 'quadlayers_custom_wc_catalog_orderby' );

Create a new snippet once more in the plugin and paste this code there.

alphabetical order sorting

After adding the new snippet, publish it. Now, go to your shop archive and check the dropdown menu for sorting.

sort by alphabetical order

You will see that the products are sorted in alphabetical order there.

If you need a no-code solution, you can also use this plugin.


While handling a WooCommerce installation, you have to try multiple ways to boost your conversion rates. To provide a better customer experience, sorting products can be convenient. As you can see above, all three methods (manually, plugin and coding) are simple and don’t need any technical knowledge. 

In addition, we have also added a few more ways to reorder the products from the products list or reorder a specific product. Similarly, we have also included some more product sorting options for you with specific categories and alphabetical order.

We hope that you can sort the products in your store without any issues now. If you found this tutorial helpful, here are some more articles that might be interesting for you:

How are you going to modify the product sorting option? Let us know in the comments.