Remove Sort by dropdownbox from Woocommerce

In Woocommerce there is a dropdown box on all product category pages which allows visitors to change the sort order of products. If you have a small shop with very few products, this does not make sense. In this article I will show you how to remove this dropdownbox.

WoocommerceSort

First you go to Appearance and then Editor. Then you find the file Woocommerce.php and find the following line:

function yiw_woocommerce_ordering() {
if ( ! is_single() && yiw_get_option( ‘shop_show_woocommerce_ordering’ ) ) woocommerce_catalog_ordering();
}

Then you insert the following lines just before these lines:

remove_action( ‘woocommerce_pagination’, ‘woocommerce_catalog_ordering’, 20 );

Then the dropdownbox should go away.

If this does not work, then try to add it to the file functions.php instead. If there is a child theme (which is best) then add it to the child theme functions.php.

What if the dropbox is not included in my theme? How can I add it?

Sometimes you will find themes where they have hidden the dropdown box by default. This makes sense when you have very few products, but if you have many products it will be best to show the dropdown box again.

Often the theme designers have hidden the dropbox in the same way like I have just showed you. So just locate Woocommerce.php or functions.php and see if you can find the following line:

remove_action( ‘woocommerce_pagination’, ‘woocommerce_catalog_ordering’, 20 );

Then remove the line or comment out the line. This should show the dropdown box again. If not then maybe the theme designers have hidden the dropdown box in other ways. Then you have to look for another solution.

 

0 0 votes
Article Rating

Andreas Andersen

Forfatter og grundlægger af IT-blogger.dk, der har blogget om IT-emner siden 2012. Findes på Mastodon på @aphandersen@ansico.dk

Abonner
Giv besked ved
guest

0 Comments
mest stemt på
nyeste ældste
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x