How to remove options from the collection filter on your Shopify theme

By default, most Shopify themes come with a few standard options to filter your products. Although adding more options can bring a meaningful degree of complexity, it's reasonably simpler to remove some of these options.

In this tutorial I'll guide you on how to remove certain options from your collection's filter.

You can click here to see a live preview of the end result. The filters "Featured" and "Best selling" were removed for the sake of this example, but you'll learn how to remove any filters.

This tutorial is compatible only with Shopify's official free themes: Colorblock, Craft, Crave, Dawn, Origin, Publisher, Refresh, Ride, Sense, Spotlight, Studio, Taste & Trade.

Looking to install this on a premium or custom theme? Feel free to contact us.

Making a backup of your theme

Before diving into the tutorial make sure you download the theme, so in case you face any issues you can easily revert back.

Creating the file with the necessary code

  1. From your Shopify admin, go to Online Store > Themes Actions Edit Code.
  2. Under the folder "snippets", click on "Add a new snippet". Name it exactly this:

    ezfy-collection-filter

  3. Copy all of the following code and paste it in the file you just created.

    gist

Choosing what options to remove from the filter

Once the code has been added to your theme, now you can choose what filters you'd like to remove. Before I get into the step-by-step of how to do this, keep this cheat sheet in mind, we'll need it for the next step:

Featured = manual
Best selling = best-selling
Alphabetically, A-Z = title-ascending
Alphabetically, Z-A = title-descending
Price, low to high = price-ascending
Price, high to low = price-descending
Date, old to new = created-ascending
Date, new to old = created-descending


Alright! Now, back to the code:

1. In the beginning of the file, you'll find the following words between backticks:



2. All you have to do is add the words you want and separate them by comma. Make sure you don't add a comma to the last word.

In the example above, the filters "Featured" and "Best selling" will be removed, since the code for "Featured" is "manual", and the code for "Best selling" is "best-selling".

Final step: enabling the code

  1. Find the file named theme.liquid.
  2. Inside this file, press CTRL + F (or CMD + F on Mac) and search for:


    
  3. Paste the following code before the  tag you found and save:

    {% include 'ezfy-collection-filter' %}


And that is it, you're good to go!



Back to blog

Leave a comment