Created
July 4, 2018 14:32
-
-
Save joe-dempsey/e63ed2f68f3e97c79bd9e9f28d66c213 to your computer and use it in GitHub Desktop.
Shopify color swatches done by product type and metafields
This file contains 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
{%- comment -%} | |
colors done by product type and metafields | |
{%- endcomment -%} | |
{%- capture the_type -%}{{ product.type }}{%- endcapture -%} | |
<div class="swatch_wrap"> | |
{% for p in collections.all.products %} | |
{% if p.type == the_type %} | |
{% if p.id == product.id %} | |
{% comment %}Active circle {% endcomment %} | |
<div class="circle_swatch active" style="background-color:{{ p.metafields.accentuate.circle_color }};"> | |
</div> | |
{% else %} | |
<a href="{{ p.url }}"> | |
{% comment %}Linking circle {% endcomment %} | |
<div class="circle_swatch" style="background-color:{{ p.metafields.accentuate.circle_color }};"> | |
</div> | |
</a> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment