Shopify themes, liquid, logos, and UX
My online skateboard shop utilizes several custom product filters. I'm using Dawn 2.0.
My custom filters are defined as product metafields. I have the Search & Discovery App installed which works well to automatically display the relevant filter values on collection pages that contain products that have the associated filter value set.
However, there are a few situations where I'd like to explicitly hide a particular filter value on a specific Collection page as only a limited number of products in the collection have that value set.
For instance, on this Skateboard Deck collection page both Deck Width and Wheelbase Filters are correctly being shown:
https://statusskateshop.com/collections/skateboard-decks
I'm trying to completely hide the Wheelbase Filter selection widget for this specific collection page while leaving the Availability, Brand and Deck Width Filters intact.
Basically a few of the products that appear in this collection will also appear in other collections where wheelbase is a very relevant filter that applies to all the other items in that collection. However, the vast majority of products in this specific collection will not have a wheelbase filter value set, so it is misleading to use the filter and only see a few results appear.
Thanks in advance for any advice!
Hello @StatusSkateshop
Welcome to Shopify Community.
So you can search for facets.liquid file and can add the condition if {% if filter.values.size > 1 %}{% endif %} like this:
Let me know if you face any issue with editing the code.
Thanks
Hi @Sweet_Savior_3 , I appreciate the welcome and response.
This certainly looks like the right spot to insert logic that would either remove the particular filter from the filter list or add some code to hide the display of that filter.
I'm looking for flexibility to do this for other similar cases as well, so the solution I'm hoping for would work regardless of how many relevant filters remain. There also many other collections where all filters should be displayed.
I was thinking something that would explicitly match the current collection name and then explicitly remove/hide the filter by name. I just don't have the familiarity with Liquid to figure it out.
Hi! This code works, however it causes the pricing filter to disappear. Any advice?
You should be able to assign any collections you don't want to include the filter in into an array, and then write an unless statement that says unless the collection is within this array and the filter label is 'Wheelbase', execute the theme code. So essentially, it will not execute the filter code for 'Wheelbase' if the current collection is within the array.
The code might look something like this:
{%- assign special_collections = 'Skateboard Decks,Longboard Decks,Cruiser Decks ' | split: ',' -%}
{%- unless special_collections contains collection.title and filter_label == 'Wheelbase' -%}
rest of the theme code that displays the filter
{%- endunless -%}
Hi community!
I have a similar request.
I'm using two filters: "Brand" (Vendor) and "Product" (Product type). Both brands and products are collections. I would like to hide "Brand" filter on the brand pages where there is one specific brand (and you cannot choose any other). And "Product" filter on product pages as it's unnecessary to display it.
Any idea how I could do that?
Thank you in advance!
K.
hey i need help with my code please
..i want to remove shop by brand in a specific brand page ..same to the other filters
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024