Skip to main content

Condition

{% if %}Shows or hides content based on an expression.

What it does

The Condition block wraps other blocks and shows them only when an expression is true. If the expression is false, the content is hidden entirely.

The condition is only evaluated on the frontend — inner blocks are always visible in the editor so you can build and style them normally.

How to use it

  1. Add a Condition block
  2. Enter an expression that evaluates to true or false
  3. Place the blocks you want to conditionally show inside
Build it visually

You don't have to write the expression by hand. The Condition Builder lets you pick the data, choose a comparison, and set a value, clause by clause.

A Condition block: a members-only sale banner on the canvas, beside its sidebar showing the visual condition builder with grouped AND/OR rules.

Under the hood, the Condition generates a {% if %} expression:

{% if user.role == 'subscriber' %}
<p class="banner">Members' Sale — extra 20% off every product.</p>
{% endif %}

See the Condition overview for writing conditions, handling the false case, and common patterns.

Next steps