Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello there,
I want to be able to hide/or show an object, depending on "if" the meta field is empty or not, of an image/icon, on the schema structure it is a "block" coming from a "section".
So if the block content is not filled, is not shown.
I'm able to hide and show content if the checkbox from the section by using
{%- if section.settings.maintooltip_product != blank -%}
But when I try the same for a block, for example
.content_tooltip
seems not been working
Any help is much appreciated
Structure on store front:
{% stylesheet %} {% endstylesheet %} {% javascript %} {% endjavascript %} {%- if blocks.settings.content_tooltip != blank -%} <div class="flex-tooltip_main"> <p> Hello </p> </div> {%- endif -%} {% schema %} { "name": "Tools Tips", "tag": "section", "class": "slideshow", "limit": 1, "settings": [ { "type": "checkbox", "id": "maintooltip_product", "default": true, "label": "Show Tool Tips", "info": "The tools tips, are soft insights about the current product displayed, there is a maximum of 3 insights per product." }, { "type": "text", "id": "title", "label": "Tool Tips" }, { "type": "color", "id": "icon_bg_color", "label": "Icons Background", "default":"#ffffff" }, { "type": "color", "id": "tooltip_bg_color", "label": "Tool Tips Background", "default":"#ffffff" }, { "type": "color", "id": "Text_tooltip_color", "label": "Tool Tips Text", "default":"#ffffff" } ], "max_blocks": 3, "blocks": [ { "name": "Tool", "type": "slide", "settings": [ { "type": "richtext", "id": "content_tooltip", "label": "Content One (1)" }, { "type": "image_picker", "id": "tooltip_icon", "label": "Icon ToolTip", "info": "Recommended .svg format" } ] } ], "presets": [ { "name": "Tools Tips", "settings": { "title": "Tool Tips" }, "blocks": [ { "type": "slide" }, { "type": "slide" } ] } ], "locales": { "en": { "title": "Tool Tips" }, "fr": { "title": "Tool Tips" } }, "enabled_on": { "templates": ["*"], "groups": ["footer"], "groups": ["aside"] } } {% endschema %}
Thank you!
Hi
To access the blocks you will need to loop through them.
{%- for block in section.blocks -%}
{%- endfor -%}
This is not the case for
section.settings
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025