Skip to content

collection

The collection template renders a single collection and its products.

Location

The collection template is located in the templates directory of the theme.

bash
└── theme
    ├── layout
    ├── templates
   ...
   ├── collection.json
   ...
    ...

Content

You should include the category object in your collection template or a section inside of the template.

Usage

Paginate products

The category object's products attribute is capped at X per page, so paginate it to reach them all:

liquid
{% paginate collection.products by 24 cod, category_id: category.id %}
  {% for product in collection.products %}
    <!-- product info -->
  {% endfor %}
{% endpaginate %}

Paginate sub-categories

You can list sub categories of a category by iterating over the subCategories object which is an array of category objects

liquid
{% for subCategory in subCategories %}
  <!-- sub-category info -->
{% endfor %}