Hide specific filter from specific collection pages

Solved

Hide specific filter from specific collection pages

PetitFox
Excursionist
20 0 6

Hello, I'm looking for a way to hide a specific filter (género) from certain collection pages (menino-2-6-anos, menina-2-6-anos, rapaz-7-12-anos and rapariga-7-12-anos). How can I do this? Thanks!

 

Captura de ecrã 2024-07-28, às 08.23.41.png

Accepted Solution (1)
BSSCommerce-HDL
Shopify Partner
2305 835 909

This is an accepted solution.

Hi @PetitFox,  Pls remove my old code and replace this new code: 

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </head> tag: 

 

{% 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 %}

 

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

View solution in original post

Replies 11 (11)

BSSCommerce-HDL
Shopify Partner
2305 835 909

Hi @PetitFox, Can you kindly share your store link (with the password protected, if any) with us? We will check it and suggest you a solution if possible.

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

PetitFox
Excursionist
20 0 6

Sure, it's petitfoxportugal.myshopify.com

BSSCommerce-HDL
Shopify Partner
2305 835 909

Hi @PetitFox

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </head> tag: 

 

 

<style>
.disclosure-has-popup:has(#Facet-1-template--23112144945501__product-grid) {
   display: none !important;
}
</style>

 

 

Here is result: 

BSSCommerceHDL_0-1722152837848.png

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

PetitFox
Excursionist
20 0 6

It worked! But I don't want to remove it from all the collection pages, only from a few. Is there a way of specifying the collections I don't want the "género" filter to show?

BSSCommerce-HDL
Shopify Partner
2305 835 909

Hi @PetitFox, Which collections do you not want to appear?

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

PetitFox
Excursionist
20 0 6

Menino (2-6 Anos); Menina (2-6 Anos); Rapariga (7-12 Anos) and Rapaz (7-12 Anos)

BSSCommerce-HDL
Shopify Partner
2305 835 909

This is an accepted solution.

Hi @PetitFox,  Pls remove my old code and replace this new code: 

Step 1: Go to Shopify Admin -> Online Store ->Theme -> Edit code

Step 2: Search file theme.liquid

Step 3: Insert this code above </head> tag: 

 

{% 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 %}

 

Hope this can help you,

If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you 😍

 

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

PetitFox
Excursionist
20 0 6

That's brilliant, it worked! Many thanks

BSSCommerce-HDL
Shopify Partner
2305 835 909

@PetitFox, No problem. Have a good day 😍

Sale banner, pop ups: Customize your sale banner, pop-ups and create countdown bar to boost conversion rate.
Simicart: Transform your Shopify store into a stunning and fully functional mobile app with just a few simple steps.
Product Labels & Badges:
Get more sales with striking labels, badges, and banners from our 10,000+ available templates.

BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now

PetitFox
Excursionist
20 0 6

Hello again. I updated the theme and it seems this code isn't working anymore. Could  I ask your help once again? Many thanks!

BSS-TekLabs
Shopify Partner
2401 695 832

Hi @PetitFox,

 

1, Navigate to Online Store > Themes > Edit Code.

2, Locate and open the theme.liquid file.

3, Paste the code snippet provided below right before the closing head tag, then save your changes.

 

<script>
    document.addEventListener("DOMContentLoaded", function() {
        const currentURL = window.location.href;
        const targetURLs = [
            "https://petitfoxportugal.myshopify.com/collections/menino-2-6-anos",
            "https://petitfoxportugal.myshopify.com/collections/menina-2-6-anos",
            "https://petitfoxportugal.myshopify.com/collections/rapaz-7-12-anos",
            "https://petitfoxportugal.myshopify.com/collections/rapariga-7-12-anos"
        ];

        if (targetURLs.some(url => currentURL.startsWith(url))) {
            const filterElement = document.querySelector("#Details-filter.p.m.custom.genero-template--23112144945501__product-grid");
            if (filterElement) {
                filterElement.style.display = "none";            
            }
        }
    });
</script>

 

We hope this assists in resolving the issue.

If you find our solution helpful, kindly consider Liking and Marking it as Accepted. Thank you!

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.


Salepify: Efficiently increase sales conversion with sale-driven features like auto add to cart, free gifts (free plan available)


Salemate: Boost your AVO with 2-layer offer, countdown upsell in your post purchase page


BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now