Hide Products with tag from collection pages + Search Results

Topic summary

Goal: hide products tagged “wholesale” from main/featured collections, product recommendations, and search in the California theme.

Solution shared: add a Liquid filter in product loops to skip items with the ‘wholesale’ tag. Logic: within each product loop, set a flag when a product has the tag and render only if the flag is false. (Liquid is Shopify’s templating language.)

Implementation detail: the working change for collection pages was placed in the snippets/collection.liquid loop, which is invoked by sections/main-collection.liquid (via render and paginate). The collection pages now exclude ‘wholesale’ products.

Search: may use the same approach if the search template renders results via Liquid loops. Whether this applies depends on the theme’s search implementation; no concrete code change was confirmed for sections/search.liquid. Status: unresolved.

Featured collections and product recommendations: initially included in the request, but no follow-up confirmation or code changes were provided for these templates. Status: unclear.

Outcome: partially resolved—collections fixed; search and other sections pending.

Summarized with AI on December 12. AI used: gpt-5.

Hey!

I’m putting together a wholesale Private collection on my page. It is all working as I was hoping however I now need to hide the products with the tag ‘wholesale’ from the main and featured collections, product recommendations and search results.

I’m using the Califonia Theme, so assume I will need to implement some code to hide these products to the following pages - sections/main-collection.liquid, sections/product-recommendations.liquid, sections/featured-collection.liquid and sections/search.liquid.

If anyone has suggestions on how to edit these, or if you suggest I go another way about this I’m open to suggestions!

Thank you!!

Hello @Intheflow ,

Yes you are right you need to add code in these files.

But it’s hard to provide instructions for it.

I suggest reaching out to app support or go with a developer.

Problem solved don’t forget to Like it and Mark it as Solution!
If you need help with customization/code part you can contact me for services

You can find the email in the signature below.

Regards
Guleria

@Intheflow Hey, thanks for posting here.

you can use this method on all product loop :

{% for product in collection.products %}
  {% assign exclude_product = false %} 

  {% for tag in product.tags %}
    {% if tag == 'wholesale' %}
      {% assign exclude_product = true %}
    {% endif %}
  {% endfor %}

  {% if exclude_product == false %}
    
  {% endif %}
{% endfor %}
1 Like

Thank you for helping!

So for example where would I Implement this in the following code?

{% paginate collection.products by section.settings.products_per_page %} {% render 'collection', products: collection.products, paginate: paginate %} {% endpaginate %}

{% schema %}
{
“name”: “t:sections.main-collection.name”,
“settings”: [
{
“type”: “header”,
“content”: “t:sections.main-collection.settings.header__1.content”
},
{
“type”: “paragraph”,
“content”: “t:sections.main-collection.settings.paragraph.content”
},
{
“type”: “checkbox”,
“id”: “show_collection_image”,
“default”: false,
“label”: “t:sections.main-collection.settings.show_collection_image.label”,
“info”: “t:sections.main-collection.settings.show_collection_image.info”
},
{
“type”: “checkbox”,
“id”: “show_collection_description”,
“label”: “t:sections.main-collection.settings.show_collection_description.label”,
“default”: true
},
{
“type”: “header”,
“content”: “t:sections.main-collection.settings.header__2.content”
},
{
“type”: “range”,
“id”: “columns_desktop”,
“min”: 1,
“max”: 6,
“step”: 1,
“default”: 4,
“label”: “t:sections.main-collection.settings.columns_desktop.label”
},
{
“type”: “range”,
“id”: “columns_tablet”,
“min”: 1,
“max”: 4,
“step”: 1,
“default”: 3,
“label”: “t:sections.main-collection.settings.columns_tablet.label”
},
{
“type”: “range”,
“id”: “columns_mobile”,
“min”: 1,
“max”: 3,
“step”: 1,
“default”: 2,
“label”: “t:sections.main-collection.settings.columns_mobile.label”
},
{
“type”: “range”,
“id”: “products_per_page”,
“min”: 8,
“max”: 24,
“step”: 4,
“default”: 12,
“label”: “t:sections.main-collection.settings.products_per_page.label”
},
{
“type”: “header”,
“content”: “t:sections.main-collection.settings.header__3.content”
},
{
“type”: “checkbox”,
“id”: “enable_filtering”,
“label”: “t:sections.main-collection.settings.enable_filtering.label”,
“info”: “t:sections.main-collection.settings.enable_filtering.info”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “enable_sorting”,
“label”: “t:sections.main-collection.settings.enable_sorting.label”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “show_labels”,
“label”: “t:sections.main-collection.settings.show_labels.label”,
“default”: true
},
{
“type”: “header”,
“content”: “t:sections.main-collection.settings.header__4.content”
},
{
“type”: “paragraph”,
“content”: “t:sections.main-collection.settings.paragraph.content”
},
{
“type”: “header”,
“content”: “t:sections.settings.header.content”
},
{
“type”: “checkbox”,
“id”: “show_background”,
“label”: “t:sections.settings.show_background.label”,
“default”: false
},
{
“type”: “checkbox”,
“id”: “expanded”,
“label”: “t:sections.settings.expanded.label”,
“default”: true
}
]
}
{% endschema %}

Check file collection.liquid under snippets you will find loop there.

That worked for the collection pages! Thanks @ProtoMan44 and @Guleria .

Could I do the same thing for the search.liquid?

@Intheflow depends on the structure.
it works if the search code method is related to liquid.

can you please mark It solved.
thanks.