Skip to main content
Liquid can print part of a template only when something is true: a “Paid” stamp for paid orders, a gift message when there is one, customs details for orders shipping abroad. In the visual editor, use a block’s Visibility tab instead (see Show a block only for some orders); this article is for code templates, Custom Liquid blocks and the Liquid condition option of a block.

if, elsif and else

unless

unless is the opposite of if:

case

Comparisons

Liquid reads and and or from right to left and has no brackets. For complex rules, nest if tags.

Common examples

Only when the order has a note:
Only for orders over 100.00 (amounts are in cents):
Only for customers tagged VIP:
Only for orders shipping outside the EU:
Only for draft orders:

Liquid conditions on visual blocks

A block’s Liquid condition is the part that goes inside {% if … %}: one expression, without tags. For example total_price >= 10000 and customer.tags contains 'VIP'. Foliant checks it as you type, against the sample order, and tells you if Liquid can’t read it.

Good to know

  • Text comparisons are case sensitive: 'vip' doesn’t match 'VIP'. The visual editor’s tag conditions with contain the text ignore case.
  • financial_status and fulfillment_status are lowercase, with underscores: paid, partially_refunded, unfulfilled, partially_fulfilled.
  • Check conditions with the Sample orders and your own recent orders in the preview order picker. See Preview, paper size and zoom.