We’ve seen in the past how to completely remove the “Default Sorting” dropdown that shows in the WooCommerce Shop, Category and Product Archive pages.
Sometimes, however, you might just need to remove one of the default options, rename a sorting option accordingly to your needs or even add a brand new sorting method. As usual, a few lines of PHP are sufficient to achieve anything, thanks to WooCommerce hooks and filters.

PHP Snippet #1: Remove a Sorting Option @ WooCommerce Shop
/**
* @snippet Remove Sorting Option @ WooCommerce Shop
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @testedwith WooCommerce 3.8
* @community https://businessbloomer.com/club/
*/
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_remove_sorting_option_woocommerce_shop' );
function bbloomer_remove_sorting_option_woocommerce_shop( $options ) {
unset( $options['rating'] );
return $options;
}
// Note: you can unset other sorting options by adding more "unset" calls... here's the list: 'menu_order', 'popularity', 'rating', 'date', 'price', 'price-desc'
PHP Snippet #2: Rename a Sorting Option @ WooCommerce Shop
/**
* @snippet Rename a Sorting Option @ WooCommerce Shop
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @testedwith WooCommerce 3.8
* @community https://businessbloomer.com/club/
*/
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_rename_sorting_option_woocommerce_shop' );
function bbloomer_rename_sorting_option_woocommerce_shop( $options ) {
$options['price'] = 'Sort by price (asc)';
return $options;
}
PHP Snippet #3: Add a Custom Sorting Option @ WooCommerce Shop
In this example, we will create a new sorting option called “Sort by name (desc)” that will indeed sort products by title (descending order).
/**
* @snippet Add a Custom Sorting Option @ WooCommerce Shop
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @testedwith WooCommerce 4.0
* @community https://businessbloomer.com/club/
*/
// 1. Create new product sorting rule
add_filter( 'woocommerce_get_catalog_ordering_args', 'bbloomer_sort_by_name_woocommerce_shop' );
function bbloomer_sort_by_name_woocommerce_shop( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'name' == $orderby_value ) {
$args['orderby'] = 'title';
$args['order'] = 'DESC';
}
return $args;
}
// 2. Add new product sorting option to Sorting dropdown
add_filter( 'woocommerce_catalog_orderby', 'bbloomer_load_custom_woocommerce_catalog_sorting' );
function bbloomer_load_custom_woocommerce_catalog_sorting( $options ) {
$options['name'] = 'Sort by name (desc)';
return $options;
}
Question. I have followed the guide, and it works for the default wordpress shop page, but I used woocommcerce’s all products block and made a new store page. It was necessary to use a custom page as my client wanted to change the slug for the page… The function does not change the drop down list for the new page. Do you know of a fix for this?
Hi Ryan, have you tried with the WooCommerce products shortcode instead?
This is great! I’d like to combine two of your tutorials but I can’t figure out how.
I want to sort by default sorting order, but also move all out of stock items to the end of the list. Is this possible?
Hi Tom thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Simple and useful, thank you.
Thanks!
Hello! I have Rife Free theme. Product sorting options do not show on the shop page. How can I fix this?
Hey Adrian, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi and thanks for your code!
But it doesn’t work for me.
Any idea of how to hide some “sort by” entries on the drop down menu?
Hi Aline, please share your code
Hi thank you for this. but can you tell me how to add categories in this? thank
https://www.businessbloomer.com/woocommerce-display-product-categories-select-list/
Thanks for reply. I think i am mistaken. I like to include categories in the default sorting in shop page. Can i do this?
Ah ok, yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Dear,
is it possible to insert image, icon etc… instead Default Sorting .woocommerce .woocommerce-ordering .ordering-selector-wrapper
Idea is to have image to represent this wrapper and on click to open drop down .
Best regards
Anything is possible 🙂
For the third snippet you didn’t actually set $orderby_value and that value isn’t passed into the function so it doesn’t ever fire.
You can set it like this though:
Thank you!
Hi Rodolfo,
I used the 3rd snippet to order products by random and works fine, but also this list need to be with available products in the beggining. Is it possible to do this?
Hello there, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
How can I remove, not hide, but actually remove the Default Sorting drop down box. It leaves too much white space at the top of the page above the product listings. I found some CSS to hide it but the white space remains. Im looking for CSS to actually remove it to adjust the padding and not leave so much whitespace.
(Would also like to remove the empty space at the top above my logo too, it’s about a half inch to an inch of whitespace at the top when scrolling)
Thanks in advance and have a good one!
Hi Jroskey, try with https://businessbloomer.com/woocommerce-remove-default-sorting-dropdown/
Can I sort by an equation? price*total_sales desc for best selling by total $ sold?
Hi Aaron, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
works great!
But…. i got an sorting option called “biggest saving” which i want to remove, what’s the unset option for that one? Can’t find it anywhere.
Thanks in advance
Not sure, that’s not default WooCommerce
Hi, I used one of the custom sorting methods where menu order value is set to negative starting from -1. When I tried this code , It did not took into consideration the Custom sorting while using ‘Sort by Name’. Please help me find a fix to it. Thanks you so much blogs like this help us new developers & designers to learn and grow and also get our work done. Hoping for a quick reply.
Hi there, not sure about negative values, sorry
Hi how to sort by recent comment in woocommerce?
Hi Drew, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
This article helped me a lot.
Rodolfo, when it comes to web development, your blog/website is the most efficient blog/website I ever come across.
THANK YOU for this amazing piece of work!
Thank you!
Rodolfo, another great tutorial that saved my life! Thank you very much for sharing your knowledge. I’m a new developer and your tutorials have provided great help to me!
Fantastic!
Nice tutorial! I just need to fix the ordering. Thanks.
Cool!
Hello!!
Is it possible to add a sort by “_featured” products? I couldn’t do achieve it with your code.
Thanks!
Hello Walter, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi,
I wanted to replace the default sorting option by the category shop list.
Like with a portfolio listing.
Do you have an idea of how I can do it ?
Regards
Hello Cine, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
legend just what I neeed
Cool!
Looking at this allows for the removal of items within the sort function…. is the a way to remove the entire thing?
The sorting div, row, container … whatever?
Yes Roberta! https://businessbloomer.com/woocommerce-remove-default-sorting-dropdown/ 🙂
Hello Rodolfo.
I need to set my woocommerce default product sorting by Product Tittle.
I will remove the filter sorting, caus will not used in my project.
But it still in sort default by another order, and not for Product Name.
how can i do this?
tks!
Hello Carlos, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Is there a way to change the order of the sorting options?
That would be awesome!
Hello Miriam – thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
The same that lottie but for my bookmarks. Thanks!! 🙂
Ahah 🙂
just what I was looking for
your website is now my home page!!!
Nice 🙂