Skip to content

Instantly share code, notes, and snippets.

@andy-williams
Created March 7, 2017 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy-williams/365af3fdf9e593475d5466dea27bc10b to your computer and use it in GitHub Desktop.
Save andy-williams/365af3fdf9e593475d5466dea27bc10b to your computer and use it in GitHub Desktop.
shopify-modulo
{% for product in collection.products %}
{% capture everyThird %}{{ forloop.index | modulo: 3 }}{% endcapture %}
{% capture everyOnePastThird %}{{ forloop.index0 | modulo: 3 }}{% endcapture %}
{% if forloop.first == true or everyOnePastThird == '0' %}
<div class="row">
{% endif %}
{% include 'product-catalog-item' %}
{% if forloop.last == true or everyThird == '0' %}
</div>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment