collection
The collection
template renders the collection page, which lists all products within a collection.
Location
The collection
template is located in the templates
directory of the theme:
└── theme
├── layout
├── templates
| ...
| ├── collection.liquid
| ...
...
Content
You should include the collection object in your section inside the template.
The collection object
You can access the Liquid collection object to display the collection details.
Usage
When working with the collection
template, you should familiarize yourself with the following:
Filter collections
You can use storefront filtering to filter collections into smaller subsets of products.
Paginate products
Products can be accessed through the products
attribute of the collection object, you should paginate a collection’s products to ensure that they’re all accessible:
{% paginate collection.products by 20 %}
{% for product in collection.products %}
<!-- product info -->
{% endfor %}
{% endpaginate %}
Updated over 1 year ago