While working on a recent customization for a WooCommerce site, I had a little difficulty tracking down exactly where the orderby drop down that appears above product listings lives in the code. Since I didn’t find a blog post addressing this directly, I thought I would share what I figured out.
To remove the drop down and ordering options completely, add the following to your functions.php file:
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’, 30 );
Some folks have commented that this works for them:
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 20 );
However, if you want to edit the drop down and make it something else. You can find the file at the following location:
/wp-content/plugins/woocommerce/template/loops/ordering.php
You can then copy that file to your theme folder, edit it, and override the default drop down.
/wp-content/themes/yourtheme/woocommerce/loops/ordering.php
Hope this helps anyone who gets stuck looking for how to remove the Orderby drop down on WooCommerce listing pages.
Hi, i try it and doesnt work for me, i use this:
.orderby{
display:none;
}
It hide the drop down but dont delete it. Do you know why the code doent work for me?
Thanks!
LikeLike
My guess is something must have changed in the new 2.0 version
LikeLike
Any idea on how to remove the ‘Show X Products’ dropdown?
I tried
.woocommerce-result-count {
display: none;
}
and that did not work.
LikeLike
Thank you Koen mkt.
Truly its work properly..
Thank you very much…
LikeLike
/*To remove Sorting drop down */
.orderby {
display: none !important;
}
LikeLike
How do i change How the sorting is done? I don’t want to remove mine but rather change how the sorting is done like sort by category.
LikeLike
I agree with with Zac, many updates took place in ver. 2.0 so taking a deep analysis of them would tell us why it isn´t working.
LikeLike
Thanks, I was figuratively pulling my hair out with this, when I’ve found your post; I was using the same code, with one exception: ’20’ instead of 30 at the end of the string
I have no idea why that matters, to my shame 🙂
Thanks a lot !
LikeLike
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’, 30 );
this is working and it is the true solution…
LikeLike
Much better!!! Thank you 🙂
LikeLike
Hello guys,
Im still trying to remove de sort menu but still nothing. I added the string on functions.php:
remove_action( ‘woocommerce_before_shop_loop’, ‘woocommerce_catalog_ordering’, 30 );
and nothing happens.
Im using wordpress 4.2.1, woocommerce 2.3.8 and Storefront 1.4.4.
Please, any idea ?
LikeLike
Just comment out the complete code (after <?php) in file
yourpath/wp-content/plugins/woocommerce/templates/loop/orderby.php
Did it in woocommerce version 2.3.9 and it works without php error. Keep the file if you want to use the orderby dropdown later.
LikeLike
I used the after_setup_theme hook and priority 10 and it works for me (WooCommerce 2.3.10 and Storefront theme 1.4.5)
Good luck!
* remove default sorting dropdown in StoreFront Theme */
function ssite_remove_catalog_ordering()
{
remove_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10);
remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10);
}
add_action('after_setup_theme', 'ssite_remove_catalog_ordering', 1);
LikeLiked by 1 person
Hi Szabesz,
your option worked. Thanks.
I put the code in the functions.php in the main theme editor and worked. Thanks mate.
LikeLike
is it possible to force the custom ordering in code ? i know there is a option in woocommerce to force the default order type. Only in my webshop the mobile fuction doesnt listen to this option and still orders bij price acs. So i would like to force the product sorting order to custom sorting order. is this possible please help
LikeLike