Last active
September 28, 2022 16:12
-
-
Save joe-dempsey/dd361351452a0114b3fca2dca28e8763 to your computer and use it in GitHub Desktop.
Shopify loops (useful for debugging)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| looping variants: | |
| {% for variant in product.variants %} | |
| <p>{{ variant.title }}</p> | |
| {% endfor %} | |
| ... more coming soon... | |
| {% for variant in product.variants %} | |
| {% if variant.available %} | |
| {% if variant.title contains "size" %} | |
| <li>{{ variant }}</li> | |
| {% endif %} | |
| {% else %} | |
| <li class="disable">{{ variant.option2 }}</li> | |
| {% endif %} | |
| {% endfor %} | |
| <p>options loop: {{ product.options | join: ', ' }}</p> | |
| {% for option in product.options %} | |
| {{ option }} | |
| {% endfor %} | |
| {% for option in product.options %} | |
| {% if option == 'Color' %} | |
| Color: {{ product.variants.first.options[forloop.index0] }} | |
| {% endif %} | |
| {% endfor %} | |
| {% for option in product.options %} | |
| {% if option contains 'Size' or option contains 'size' or option contains 'Sizes' or option contains 'sizes' %} | |
| <p class="product-size">{{ product.variants.options[forloop.index0] }}</p> | |
| {% endif %} | |
| {% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment