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
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024