Shopify Liquid Examples

From the Directed Edge Developer Base
Revision as of 17:43, 10 October 2013 by Lucijan (talk | contribs) (Created page with "== Basic Example (Textual output) == This first example demonstrates iterating through different recommendation types (<tt>groups</tt>) and listing a maximum of five recommended ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Basic Example (Textual output)

This first example demonstrates iterating through different recommendation types (groups) and listing a maximum of five recommended products per group:

{% for group in groups %}
<h3>{{group.label}}</h3>
<ul>
  {% if group.bundle %}
  <li><a href="{{bundle.buy_link}}">{{bundle.text}}</a></li>
  {% else %}
  {% for product in group.products limit:5%}
  <li>
    <a href="{{product.url}}">{{product.title}}</a>
    for {{product.price | money}}
  </li>
  {% endfor %}
  {% endif %}
</ul>
{% endfor %}