Created
May 2, 2015 08:20
-
-
Save DanWebb/6e28c5e0fed783f0698e to your computer and use it in GitHub Desktop.
Get whether some (but not all) of the variants products are out of stock
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
{% assign some_stock = false %} | |
{% assign out_of_stock = 0 %} | |
{% for variant in product.variants %} | |
{% if variant.available == false %} | |
{% assign out_of_stock = out_of_stock | plus: 1 %} | |
{% endif %} | |
{% endfor %} | |
{% if product.variants.size != out_of_stock and out_of_stock > 0 %} | |
{% assign some_stock = true %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment