How to remove the sorting option in the WooCommerce Storefront Theme

Here’s how it’s done (it’s a PNG):

solution to removing the sorting in woocommerce

Put this snippet in your theme’s function.php

This is the official way to do it. It will remove the sorting from the entire webshop. I am not against the display: none method, I just thought there must be another way to do this except with css.

All the other code like this did not work for me:
remove_filter( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );

And here is why it does not work

First of all, the remove_filter() function and the remove_action() function are the same function. As are the add_filter() and the add_action(). That means it does not matter which one you will be using.

That being said, if you want to remove a feature that comes from a plugin (which is what WooCommerce is) you cannot simply place in your functions.php this line of code:

remove_filter( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );

You have to wrap it into a function. This is literally stated in the WordPress Codex:

remove_action() must be called inside a function and cannot be called directly in your plugin or theme.

Let me know if you don’t know what the, remove_filter, remove_action, add_filter and add_action actually are. I’ll explain that.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s