Created
December 5, 2018 18:15
Code for creating a table based on variants
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
{% assign vmachine = shop.metafields.custom_fields["variant_table_properties"] | split: "|" %} | |
<div class="variant-custom-fields-wrapper"> | |
{%- for variant in product.variants -%} | |
<div class="variant-custom-fields" data-variant-id="{{ variant.id }}"> | |
<br /> | |
<div class="variant__title"><h3>{{variant__title}}</h3></div> | |
<div class="variant__cf"> | |
{% if vmachine != blank %} | |
<table> | |
{% for vinfo in vmachine %} | |
{% assign vmachine_item = vinfo | split: '='%} | |
{% assign vhuman_name = vmachine_item[0] %} | |
{% assign vmachine_name = vmachine_item[1] %} | |
{% if variant.metafields.custom_fields[vmachine_name] !=blank %} | |
<tr> | |
<td>{{ vhuman_name }}</td> | |
<td>{{ variant.metafields.custom_fields[vmachine_name] }}</td> | |
</tr> | |
{% endif %} | |
{% endfor %} | |
</table> | |
{% endif %} | |
</div> | |
</div> | |
{%- endfor -%} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment