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 %}
{% endif %}
Hope this helps!
Problem: In a Shopify theme, custom metafields (custom fields for product description/preorder info) were still showing on the product page even when empty. The author shared main-product.liquid and screenshots to illustrate.
Solution: Wrap the parent container in a Liquid (Shopify’s templating language) conditional so it only renders when content exists. Specifically, check whether the relevant metafield outputs (e.g., block.settings.content or block.settings.page.content) are not blank before rendering the block.
Outcome: The conditional approach worked and successfully hides empty metafields. The issue is resolved; no further steps were requested.
Notes: Code and screenshots were provided for context, but the key fix is the Liquid if-statement guarding the block so no markup is output when the metafields are blank. No disagreements or open questions remain.
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 %}
{% endif %}
Hope this helps!