Liquid, JavaScript, themes, sales channels
Hi all, I use some liquid conditional statements that hides empty metafields from rendering and wish to build it into a JSON metafield in order to add it as a dynamic source in a template.
Is this possible at all? I have attempted to follow some forum suggestions but get error messages on save.
The code is:
<div>
{% if product.metafields.custom.brand != blank %}
<div> <B>Brand:</B> {{ product.metafields.custom.brand }}</div>
{% endif %}
</div>
<div>
{% if product.metafields.custom.model != blank %}
<div> <B>Model:</B> {{ product.metafields.custom.model }}</div>
{% endif %}
</div>
and so on. Or is there another way to add conditional logic to metafields added in a template so as not to leave blank spaces?
H
User | RANK |
---|---|
38 | |
27 | |
13 | |
11 | |
8 |
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023