Last active
November 14, 2021 15:22
-
-
Save sweethoneycode/e25b911958a844b3941ee9e53aff4799 to your computer and use it in GitHub Desktop.
Color Metafield
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 -%} | |
variable to hold color | |
{%- endcomment -%} | |
{%- assign product_color = product.metafields.my_fields.color -%} | |
{%- comment -%} | |
Color Metafield and attributes | |
{%- endcomment -%} | |
{%- if product.metafields.my_fields.color -%} | |
<p><b>Color (default): </b> {{ product.metafields.my_fields.color }} <div style="display: inline-block; background-color:{{ product.metafields.my_fields.color }};width:10px;"> </div></p> | |
<p><b>Color (red): </b> {{ product.metafields.my_fields.color.value.red }}</p> | |
<p><b>Color (blue): </b> {{ product.metafields.my_fields.color.value.blue }}</p> | |
<p><b>Color (green): </b> {{ product.metafields.my_fields.color.value.green }}</p> | |
{%- endif -%} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment