Change Default Product Sorting
The default WooCommerce sorting is by “menu order”, which means manually and if a manual product order is not set, the product are going to be displayed alphabetically.
Before we continue, let me show you how to sort WooCommerce products manually, maybe it is just what you need.
Go to WordPress admin, All Products page, and there click Sorting tab. After that just use drag and drop.

The second way is to set menu_order
value manually in the product data metabox.

Now let me show you how to change this default product sorting “menu_order + title” to something else. It can be done in WooCommerce settings as well or even with the filter hook.
Change the Product Sorting in WooCommerce Settings
If you have WooCommerce 3.2.6 or below, you can go to Settings > Products > Display tab and change the default sorting there. Otherwise, if your WooCommerce version is 3.3.0 and above, you couldn’t find Display tab, because it was completely moved to Customizer.
So, go to Appearance > Customize > WooCommerce > Product Catalog. And here we are.

You might see on the screenshot above that when we change the value of default product sorting in customizer, it also changes in product sorting dropdown above the product list. If you with to remove it from there, this tutorial is for you.
Using Hook to Change the Default Product Ordering in the Code
As simple as to insert the below code into your current theme functions.php
file.
add_filter( 'woocommerce_default_catalog_orderby', 'misha_default_catalog_orderby' );
function misha_default_catalog_orderby( $sort_by ) {
return 'date';
}
Possible values are:
menu_order
(Default) – by the custom order first, then by product namepopularity
– by the number of salesrating
– by the average ratingdate
– recently added products will be displayed firstprice
– cheapest products will be displayed firstprice-desc
– the most expensive firstrand
– in a random order (read also how to retain pagination in this case)
It is also possible to create a custom product ordering, for example to display products in stock first.
Change the Default Ordering only for a Certain Category
Sometimes you may need it too. Actually you can use the same code, but just add a condition like is_product_category( 'category-slug' )
. Example:
add_filter( 'woocommerce_default_catalog_orderby', 'misha_catalog_orderby_for_category' );
function misha_catalog_orderby_for_category( $sort_by ) {
if( ! is_product_category( 'uncategorized' ) ) {
return $sort_by; // no changes for any page except Uncategorized
}
return 'date';
}

Misha Rudrastyh
Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me
Would it be possible for you to update this for WooCommerce 3.8+? The “Product Catalog” section is no longer there. (Why do they find it necessary to change things like this so often? You only wrote this in August and it’s already outdated. Is WooCommerce trying to make this purposefully more difficult or something?)
Hey Trevor,
Hmmm.. Product Catalog option is still there for me in WooCommerce 3.9.2 🙃
Many thanks for your help
Hi, is it possible to sort by either of…
1) Custom field (an integer in this case)
2) Category name (a 2 decimal place number that represents a year and week number ie 2020.16)
Thank you!
Mark
Hi Mark,
Yes, absolutely, in this case you have to make it work with
pre_get_posts
filter hook.Great article! Works a treat :)
Is this possible to change/add to “popularity” sort ok, but for one month back?
Please check this tutorial, I think it may help you.
Extraordinary article, congratulations!
I’d like to know how this works with Products attributes.
Best regards,
Thanks!
Thank you so much for writing on this blog. Your blog saves my time.
Genius! You really helped me out – I’ve been looking for this info for a while!
Victoria, thank youu!
I also have another question, do you have any idea how to take the WordPress/woo commerce OUT OF STOCK badge off. I downloaded a plugin (sold out badge) for ‘out of stock’ which I prefer as it displays on the photo but the woo commerce one is under the image and so makes my images misaligned.
Thanks
Victoria – a beginner!
Thanks a lot, this helped a lot!
This helped a lottttt !! Very big thanks.
Just what I was looking for, thanks for sharing!
thank you
Thanks – this was really helpful
Thank you
Thank you
Thank you so much! Native sorting is quite hidden—thought I’d need a plugin. WP should make this more visible.
I don’t know who you are, but the world doesn’t deserve you
Thank you guys god bless you