LiquidConditional Sections

Conditional Sections

Some sections belong on some products only: a size guide on clothes, a care card on ceramics. Merchants decide that with visibility rules on the section, and a template can make finer, content-level choices itself.

Visibility rules

Rules live on the section, not in its settings, and work for Liquid sections exactly as for built-in ones. The merchant sets them from the section's Visibility panel; there is nothing to declare in your schema.

Product ruleOperatorsValue
product · collection · tag · vendor · product_typein · not_inLists of ids, handles or names
on_sale · in_stock · has_variantsistrue or false
pricegt · lt · betweenStore currency; between takes [min, max]

Rules combine with all or any. A device rule shows the section on all devices, mobile only or desktop only. In the editor every section stays visible so it can still be edited; the rules apply on the live store.

Branching inside the template

For decisions about content rather than the whole section, branch on the product, the page type or the editor. In the preview, add or remove apparel from the condition, or switch the route.

Branchingliquid
{%- if product.tags contains "apparel" or product.type == "Shirts" -%}
<aside style="margin: 24px; padding: 16px; border: 1px dashed var(--color-border); border-radius: var(--radius); font-family: var(--font-body);">
<strong>Size guide</strong> · Runs true to size. Between sizes? Size up.
</aside>
{%- elsif template.name == "product" -%}
<aside style="margin: 24px; font-family: var(--font-body);">Care: wipe clean.</aside>
{%- endif -%}
{%- if request.design_mode -%}
<p style="margin: 24px; font: 12px system-ui; color: var(--color-text-muted);">
Shown in the editor only: tag products “apparel” to get the size guide.
</p>
{%- endif -%}
TestUse it for
product.tags contains "…"Content for a group of products the merchant tags.
product.type · product.vendorContent per type or brand.
template.name · request.page_typeA section shared across page types that changes per page.
request.design_modeHints or placeholders for the merchant that shoppers never see, or keeping an animation still while editing.
shop.customer_accountsHiding sign-in links on stores without customer accounts.

Prefer rules for whole sections

Hiding a whole section with Liquid still leaves it in the page, with its spacing. A visibility rule removes it, and the merchant can change it without editing code.

Still stuck? Our team reads every message.

Need help?