Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I am trying to hide my metafields when empty, but cant seem to get it right
Add != blank with metafield in if condition
{% if product.metafields.namespace.key != blank %}
<div class="metafield">{{ product.metafields.namespace.key }}</div>
{% endif %}
Hi, Thank you for the quick response! Could you please tell if this is the correct section to add in the above bit of code? Is it possible to let me know where to add this in exactly? We have 2 tabs/ metafields we need only to be available on some items, more intricate items that warrant extra information, for other items these extra fields are not necessary or would not have enough information to make it worth while for these to be visible. These 2 are ''Specifications'' and ''Who is this for?''
},
"5037f519-1343-4167-a315-31c99471503f": {
"type": "tab",
"settings": {
"column": "primary",
"title": "Specification",
"text": "<p>{{ product.metafields.custom.specification_wolf_king_gt | metafield_tag }}<\/p>",
"image_width": 1000,
"align": "center",
"link": "",
"tab_content": "",
"open": false
}
},
"c13717d6-5def-40f5-9684-68f8f103b0d4": {
"type": "tab",
"settings": {
"column": "secondary",
"title": "Who is this scooter for?",
"text": "<p>{{ product.metafields.custom.who_is_this_for_ | metafield_tag }}<\/p><p><\/p>",
"image_width": 1000,
"align": "center",
"link": "",
"tab_content": "",
"open": false
Good day, just following up on this query, would really appreciate assistance on this matter 🙂
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025