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.
Also, please bear in mind that this code will not work on all themes. The following code was confirmed to be compatible with the following themes: Dawn, Ride, Sense, Craft, Colorblock, Crave, Taste, Studio, Refresh.
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
- From your Shopify admin, go to Online Store > Themes > Actions > Edit Code.
- Under the folder “snippets”, click on “Add a new snippet”. Name it exactly this:
ezfy-collection-filter - Copy all of the following code and paste it in the file you just created.
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
- Find the file named theme.liquid.
- Inside this file, press CTRL + F (or CMD + F on Mac) and search for:
</body> - Paste the following code before the </body> tag you found and save:
{% include 'ezfy-collection-filter' %}
And that is it, you're good to go!
Was this article helpful?