Collections

From Shopify Wiki

Revision as of 18:45, 9 March 2009 by Dariusdr (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
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