Hide filter "Gender" from specific collection pages

Hello, I’m looking for a way to hide a specific filter (gender) from certain collection pages (menino-2-6-anos, menina-2-6-anos, rapaz-7-12-anos and rapariga-7-12-anos). I’m using Dawn theme and my website is petitfoxportugal.myshopify.com.

I once used the code below before the tag but it is not working now. How can I get it to work? Thanks!

{% assign full_url = request.host | append: request.path %}
{% if full_url contains 'menino-2-6-anos' or full_url contains 'menina-2-6-anos' or  full_url contains 'rapaz-7-12-anos' or full_url contains 'rapariga-7-12-anos' %}
<style>
.disclosure-has-popup:has(#Facet-1-template--23112144945501__product-grid) {
   display: none !important;
}
</style>
{% endif %}

Hi,

You can edit your code to look like this

{% assign full_url = request.host | append: request.path %}
{% if full_url contains 'menino-2-6-anos' or full_url contains 'menina-2-6-anos' or  full_url contains 'rapaz-7-12-anos' or full_url contains 'rapariga-7-12-anos' %}

{% endif %}

or

{% assign full_url = request.host | append: request.path %}
{% if full_url contains 'menino-2-6-anos' or full_url contains 'menina-2-6-anos' or  full_url contains 'rapaz-7-12-anos' or full_url contains 'rapariga-7-12-anos' %}

{% endif %}

If it helps you, please like and mark it as the solution.

Best Regards

1 Like

Hi @PetitFox

You can try to use this code and check

{% if collection.handle contains 'menino-2-6-anos' or collection.handle contains 'menina-2-6-anos' or  collection.handle contains 'rapaz-7-12-anos' or collection.handle contains 'rapariga-7-12-anos' %}

{% endif %}

Thanks! The first one worked :raising_hands: