Created
May 11, 2016 18:50
-
-
Save projoomexperts/cb89ca5532435fa63450d4e481b537a6 to your computer and use it in GitHub Desktop.
Shopify size variant label in collection page under product.
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
<ul class="sizelist"> | |
{% for option in product.options %} | |
{% if option == 'Size' %} | |
{% assign index = forloop.index0 %} | |
{% assign colorlist = '' %} | |
{% assign color = '' %} | |
{% for variant in product.variants %} | |
{% capture color %} | |
{{ variant.options[index] }} | |
{% endcapture %} | |
{% unless colorlist contains color %} | |
{% if variant.available %} | |
<li id="{{ variant.id }}" title="{{ variant.inventory_quantity }} In Stock" class="avactive"><a href="{{ product.url | within: collection }}?variant={{ variant.id }}">{{ color | downcase }}</a></li> | |
{% else %} | |
<li id="{{ variant.id }}" title="Out of Stock" class="notactve" >{{ color | downcase }}</li> | |
{% endif %} | |
{% capture tempList %} | |
{{colorlist | append: color | append: " " }} | |
{% endcapture %} | |
{% assign colorlist = tempList %} | |
{% endunless %} | |
{% endfor %} | |
{% endif %} | |
{% endfor %} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment