if

Executes a block of code only if a certain condition is true.

Input

{% if product.title == "Awesome Shoes" %}
  These shoes are awesome!
{% endif %}

Output

These shoes are awesome!

elsif / else

Adds more conditions within an if or unless block.

Input

<!-- If customer.name = "anonymous" -->
{% if customer.name == "kevin" %}
  Hey Kevin!
{% elsif customer.name == "anonymous" %}
  Hey Anonymous!
{% else %}
  Hi Stranger!
{% endif %}

Output

Hey Anonymous!
PDF HTML Epub Powered by Read The Docs