Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Using a theme and It has me using metafields to add product description/preorder info on my product page (see screenshots). I'm also including the code for my main-product.liquid. I've tried a few options I've seen on the forum, but none of them seem to be working for me. If someone can tell me how to hide any metafields when blank, that would super helpful!
Thank you!
Solved! Go to the solution
This is an accepted solution.
One way to do this is by surrounding the parent div with an if statement like this:
{% if block.settings.content != blank or block.settings.page.content != blank %}
<div class="product__accordion accordion quick-add-hidden" {{ block.shopify_attributes }}>
<details id="Details-{{ block.id }}-{{ section.id }}">
<summary>
<div class="summary__title">
{% render 'icon-accordion', icon: block.settings.icon %}
<h2 class="h4 accordion__title inline-richtext">
{{ block.settings.heading | default: block.settings.page.title | escape }}
</h2>
</div>
{% render 'icon-caret' %}
</summary>
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{{ block.settings.content }}
{{ block.settings.page.content }}
</div>
</details>
</div>
{% endif %}
Hope this helps!
This is an accepted solution.
One way to do this is by surrounding the parent div with an if statement like this:
{% if block.settings.content != blank or block.settings.page.content != blank %}
<div class="product__accordion accordion quick-add-hidden" {{ block.shopify_attributes }}>
<details id="Details-{{ block.id }}-{{ section.id }}">
<summary>
<div class="summary__title">
{% render 'icon-accordion', icon: block.settings.icon %}
<h2 class="h4 accordion__title inline-richtext">
{{ block.settings.heading | default: block.settings.page.title | escape }}
</h2>
</div>
{% render 'icon-caret' %}
</summary>
<div class="accordion__content rte" id="ProductAccordion-{{ block.id }}-{{ section.id }}">
{{ block.settings.content }}
{{ block.settings.page.content }}
</div>
</details>
</div>
{% endif %}
Hope this helps!
That worked! Thank you so much!
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025