Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{% assign machine = shop.metafields.custom_fields["variant_fields"] | 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 }}<strong> Model</strong></h3></div>
<div class="variant__cf">
{% if machine != blank %}
{% for info in machine %}
{% assign machine_item = info | split: '='%}
{% assign human_name = machine_item[0] %}
{% assign machine_name = machine_item[1] %}
{% if variant.metafields.custom_fields[machine_name] !=blank %}
<div>
<strong>{{ human_name }}:</strong>
{{ variant.metafields.custom_fields[machine_name] }}
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
{%- endfor -%}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.