Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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!!
Solved! Go to the solution
This is an accepted solution.
@Intheflow Hey, thanks for posting here.
you can use this method on all product loop :
{% for product in collection.products %}
{% assign exclude_product = false %} <!-- Default to false -->
{% for tag in product.tags %}
{% if tag == 'wholesale' %}
{% assign exclude_product = true %}
{% endif %}
{% endfor %}
{% if exclude_product == false %}
<!-- Product display code here -->
{% endif %}
{% endfor %}
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
This is an accepted solution.
@Intheflow Hey, thanks for posting here.
you can use this method on all product loop :
{% for product in collection.products %}
{% assign exclude_product = false %} <!-- Default to false -->
{% for tag in product.tags %}
{% if tag == 'wholesale' %}
{% assign exclude_product = true %}
{% endif %}
{% endfor %}
{% if exclude_product == false %}
<!-- Product display code here -->
{% endif %}
{% endfor %}
Thank you for helping!
So for example where would I Implement this in the following code?
<div class="content {% render 'content-classes', scope: section %}" data-section-id="{{ section.id }}" data-section-type="collection">
{% paginate collection.products by section.settings.products_per_page %}
{% render 'collection', products: collection.products, paginate: paginate %}
{% endpaginate %}
</div>
{% 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.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025