Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hi Shopify Community,
I'm working on a custom drawer accordion for my Shopify store and I'm having trouble displaying the content from metafield pages correctly. Here are the details:
Can you help me out please? what I'm doing wrong?
{%- if drawer != blank -%} {% assign acc_titles = drawer.acc_title.value %} {% assign acc_icons = drawer.acc_icon.value %} {% assign acc_pages = drawer.acc_page.value %} {% assign acc_rich_texts = drawer.acc_rich.value %} {% assign array_size = acc_titles.size | minus: 1 %} {%- for i in (0..array_size) -%} {% assign title_value = acc_titles[i] %} {% assign icon_value = acc_icons[i] | downcase | replace: " ", "-" | replace: "_", "-" | replace: ".", "-" %} {% assign page_value = acc_pages[i] %} {% assign rich_value = acc_rich_texts[i] %} {%- if rich_value != blank or page_value.content != blank -%} {%- capture item_content -%} <div class="prose"> {%- if page_value.content != blank -%} {{ page_value.content }} {%- else -%} {{ rich_value | metafield_tag }} {%- endif -%} </div> {%- endcapture -%} {%- render 'accordion-dynamic', icon: icon_value, title: title_value, content: item_content, class: 'product-info__accordion', block: block -%} {%- endif -%} {%- endfor -%} {%- endif -%}
Thank you,
If debugging is returning null, that means that the acc_page isn't being populated properly. Before ruling out bugs, have you tried adding debugging code outside of your conditional?
I still getting null, even before the loop, but I have make sure there is content on the page, I'm not quite sure, why I'm not getting any result.