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.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024