skip to Main Content
{% for collection in collections %}
{% for product in collections.collection.handle.products %}
{{ product.name }}
{% endfor %}                                            
{% endfor %} 

I am building templates in Shopify which show all products I am using the cheat sheet example to get all product but it is working like this one.

This is not working in my liquid page I am using another method to get the collection name and show all product with this collection one loop is to get the collection name one is to get the product list related to that collection.

2

Answers


  1. There is a collection called "all" that has all your products in it. It is automatically created and can be override when you create a "all" collection with the same name/url.

    More Infor here on the All collection

    {% for product in collections.all.products %}
    {{ product.name }}
    {% endfor %}
    
    Login or Signup to reply.
  2. For nested looping in Shopify collection and product use this one:

    {% for collection in collections %}
       {{ collection.title }}
      {% for product in collection.products %}
        {{ product.title }}
      {% endfor %}
    {% endfor %}
    

    Using this you can get all details of collection and list out the all product of this collections.
    This code is working and currently use this code in my store also.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search