Collections

From Shopify Wiki

Jump to: navigation, search

The liquid variable _collections_ contains a list of all the collections this shop uses.

You can access collections by calling their handle.

Example usage:

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

You can also use an indexed-style access, using either a literal or a variable:

{% for product in collections['frontpage'].products %}
   {{ product.title }}
{% endfor %}

-- or --

{% assign: collectionName = 'frontpage' %}
{% for product in collections[collectionName].products %}
   {{ product.title }}
{% endfor %}

This would print the names of all products that are in collection _frontpage_

Personal tools