I'm having an issue with Shopify products in collection page. I want to display products separately in collection pages. I have one collection [all products]
and it have more than 200
products. All products have vendor like Red, Green, Yellow and so on. It have more than 10 vendors. If I do manually it work but not expected.
{% paginate collection.products by 50 %}
{% for product in collection.products %}
{% assign vendor = product.vendor | downcase | replace: ' ', '_' %}
{% if vendor == 'green' %}
<h2>Green</h2>
{% include 'product-card' %}
{% elsif vendor == 'red' %}
<h2>Red</h2>
{% include 'product-card' %}
{% elsif vendor == 'yellow' %}
<h2>Yellow</h2>
{% include 'product-card' %}
{% endif %}
{% endfor %}
{% endpaginate %}
I don't want to set if
condition set manually because I don't know how many vendors I have. Vendor H2
tag showing twice because inside of forloop
.
How I wanted if vendor is green then show all green vendor products and title shouldn't be twice. Help will be appreciated.
I want like below example of Image
Note: Unable to showing live example because it's in Shopify also Store password protected.
200+
products. I don't want to show more than50
products on page I will add pagination. My issue is I can't filter product by vendor. it shouldn't be customer selection. Example added in question description. – Rahul50
products per page but product should be separated by vendor. Like above images. Can I show200+
products without pagination and achieve my goal? – Rahul