Shopify themes, liquid, logos, and UX
I'm having some trouble understanding what I'm doing wrong, I'm trying to show and hide content if a meta field is filled or not. In this case is an image. But It seems I'm missing something important.
{%- if setting.tooltip_icon_one != blank -%} <!-- Content to be displayed when the checkbox is checked --> <p>
Content here, images, etc.
</p> {%- endif -%}
And the shema structure:
{% schema %} { "name": "Product pages", "class": "section-product-template", "blocks": [ { "type": "@app" }, { "type": "title", "name": "Title", "limit": 1, "settings": [ { "type": "checkbox", "id": "heading_h1", "label": "Set as primary page heading", "info": "info", "default": true } ] }, { "type": "price", "name": "Price", "limit": 1, "settings": [ { "type": "checkbox", "id": "show_tax_and_shipping", "label": "Show tax status and shipping policy link", "default": false } ] }, { "type": "product_tooltip", "name": "Tool Tips", "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 4 insights per product." }, { "type": "image_picker", "id": "tooltip_icon_one", "label": "Icon ToolTip One (1)", "info": "Recommended .svg format" }, and goes all the way down...
On theme store front:
can you help me please to understand how can show content if a meta field is filled?
I have been trying as well, with the check box .maintooltip_product when checking the box is "checked", and shows to content, but is the same.
Thank you.
Solved! Go to the solution
This is an accepted solution.
Because this is the block setting. so you should use block instead of section.
i mean. {%- if block.settings.maintooltip_product != blank -%}
Hello,
Please use this
{%- if section.setting.tooltip_icon_one != blank -%} <!-- Content to be displayed when the checkbox is checked --> <p>
Content here, images, etc.
</p> {%- endif -%}
Because this is not a theme setting its a section setting. so must add section. before the settings.
if our solution is helpful for you then please like the post and tap on accepted.
Thankyou
Thank you for your reply and help,
For some reason, is still without working,
I have tried creating a section directly, and it works
But on the current one, is not working.
{%- if section.settings.maintooltip_product != blank -%}
<p> content here, etc.</p>
{%- endif -%}
maybe should I add bloks?
{%- if section.settings.blocks.maintooltip_product != blank -%} ?
Thank you
This is an accepted solution.
Because this is the block setting. so you should use block instead of section.
i mean. {%- if block.settings.maintooltip_product != blank -%}
our pleasure 🙂
Thankyou for reaching us
To make more context, I'm trying to make it work inside the product section.
On the section test I did, it works,
but in the product section, it doesn't work "if" {%- if section.settings.maintooltip_product != blank -%} when I have checked the check box.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By 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, 2024