---
title: "The If, Elsif, and Else Tags"
slug: "if-else-elsif-tags"
updated: 2026-04-16T19:44:24Z
published: 2026-04-16T19:44:24Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://knowledge.technolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# The If, Elsif, and Else Tags

In [Liquid markup](/v1/docs/getting-started-with-liquid-markup), the `if`, `elsif`, and `else` tags are fundamental to Liquid markup and are essential components for conditional logic.

## `if`

The `if` tag creates simple conditional logic, and is composed of two basic pieces: the **condition**and the **output**.

The condition and the output are arranged like so:

```plaintext
{% if condition %} 
    output 
{% endif %}
```

The condition sets the logical requirements for the output’s appearance. If the condition evaluates to *true*, the output appears, otherwise, it does not.

Consider the following example:

```plaintext
{% if {{app_program}} == 'Art' %} 
    Welcome to Slate University's Fine Arts Program!
{% endif %}
```

The condition, `if {{app_program}} == 'Art'`, is saying:

- If the value for the `app_program` export is `Art`, then output `Welcome to Slate University’s Fine Arts Program!`.
- If the value in the condition statement is not `Art`, then output nothing.

#### `{% endif %}`

Every opened tag must have its closing tag: for `if`, that closing is `{% endif %}`.

> [!WARNING]
> 📝 Without the closing tag, the conditional statement won’t function as intended.

## `elsif`

The `elsif` tag is another basic component in Liquid markup that goes one step further than `if`: it allows for the evaluation of **multiple conditions.**

`elsif` functions much like the `if` tag; however, unlike the `if` tag, it can not be used as a standalone tag. It must always be preceded by an `if`.

An `elsif` tag, just like an `if` tag, is composed of a condition and output, but in this case, there may be multiple conditions and multiple outputs.

Consider the following example:

```plaintext
{% if {{app_program}} == 'Art' %} 
    Welcome to Slate University's Fine Arts Program! 
{% elsif  {{app_program}} == 'Medicine' %}
    Welcome to Slate University's School of Medicine!
{% endif %}
```

This set of conditions can be translated as:

- If the value for the `app_program` export is `Art`, then output `Welcome to Slate University’s Fine Arts Program!`.
- If that’s not the case, but the value for the `app_program` export is instead `Medicine`, then output `Welcome to Slate University’s School of Medicine!`.
- If neither condition is true, then output nothing.

#### Multiple `elsif` tags

You can use as many `elsif` tags as you need.

At some point though, especially in the case of programs or majors, it can be more beneficial to use **merge fields**and **Configurable Joins**to dynamically display the value, rather than using Liquid markup to account for every possibility.

## `else`

The `else` tag is also not a standalone component and must be accompanied by an `if` statement.

`else` is a final or catchall tag. The `else` tag does not have a condition, like the `if` tag and `elsif` tags, and must be placed at the end of the full statement.

There are two ways of using the `else` tag in Liquid markup.

The first:

```plaintext
{% if {{app_program}} == 'Art' %} 
    Welcome to Slate University's Fine Arts Program! 
{% else %} 
    Welcome to Slate University! 
{% endif %}
```

This can be translated as:

- If the value for the `app_program` export is `Art`, then output `Welcome to Slate University’s Fine Arts Program!`.
- If it doesn’t have that value, just output `Welcome to Slate University!`.

The second:

```plaintext
{% if {{app_program}} == 'Art' %} 
    Welcome to Slate University's Fine Arts Program! 
{% elsif {{app_program}} == 'Medicine' %} 
    Welcome to Slate University's School of Medicine! 
{% elsif {{app_program}} == 'Biology' %} 
    Welcome to Slate University's School of Science! 
{% else %} 
    Welcome to Slate University! 
{% endif %}
```

This second example can be translated as:

- If the value for the**`app_program` export is `Art`, then output `Welcome to Slate University's Fine Arts Program!`.
- If that’s not the case, but the value for the `app_program` export is instead `Medicine`, then output `Welcome to Slate University's School of Medicine!`.
- If that’s not the case, but the value for the `app_program` export is instead `Biology`, then output `Welcome to Slate University's School of Science!`.
- If none of these conditions is true, output `Welcome to Slate University!`.

The second of these examples can become cumbersome if there are a large number of different values to evaluate. In some cases, it may be more beneficial and efficient to use **merge fields**to display information dynamically.

**📖**See the [Shopify documentation on conditional tags](https://shopify.dev/docs/api/liquid/tags/conditional-tags).

## Related

- [Getting Started with Liquid Markup](/getting-started-with-liquid-markup.md)
