-
-
Save carbone/4ad9d020a18b457f65ead94e01d8a10c to your computer and use it in GitHub Desktop.
Add this to custom_fields_accordions.liquid
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 %} | |
Help Article | |
https://customfields.zendesk.com/hc/en-us/articles/360000919672 | |
Theme Files | |
/assets/custom-fields-accordions.js | |
/assets/custom-fields-accordions.scss.css | |
theme.liquid <head> section. | |
product.liquid or product-template.liquid, changes made to include this file. | |
{% endcomment %} | |
{% assign acc = shop.metafields.custom_fields["accordion_definition"] | split: '|' %} | |
{% if acc %} | |
<div id="custom-fields-accordion"> | |
{% assign acc_item = '' %} | |
{% assign acc_index = '' %} | |
{% for acc_info in acc %} | |
{% assign acc_item = acc_info | split: '=' %} | |
{% assign acc_index = acc_item[0] %} | |
{% assign acc_label = acc_item[1] %} | |
{% if product.metafields.custom_fields[acc_index] != null %} | |
<div class="accordion-section"> | |
<a class="accordion-section-title" href="#{{ acc_index }}">{{ acc_label }}</a> | |
<div id="{{ acc_index }}" class="accordion-section-content"> | |
{{ product.metafields.custom_fields[acc_index] }} | |
</div> | |
</div> | |
{% endif %} | |
{% endfor %} | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment