Last active
April 25, 2022 18:18
-
-
Save imCorfitz/fc3248567a31598c75f4bd91c7c6b912 to your computer and use it in GitHub Desktop.
Adding colour swatches to Shopify collection pages using metafields.
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
{% comment %} Show color options {% endcomment %} | |
{%- if product_card_product.metafields.product_info.color.type == "list.color" -%} | |
<div class="color-options"> | |
{%- for color in product_card_product.metafields.product_info.color.value -%} | |
<div class="color-options__item" style="background-color:{{color}};"> </div> | |
{%- endfor -%} | |
</div> | |
{%- endif -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment