---
title: "Conditional Content"
description: "Create variants of a structure and attach conditions to them, so different audiences receive different content from a single template."
url: https://docs.topol.io/email-editor/guide/conditional-content.html
---

# Conditional Content

> **This feature is available with the Plugin for Business plan and higher.**
>
> If you're on the Plugin for Startup or Plugin Expansion plan, consider upgrading to access this feature. For more details, visit our [pricing page](https://topol.io/pricing) or contact support.

**Conditional Content lets a single section carry several variants, each shown only when its condition matches.** It covers audience personalization and A/B structures, and the variants are edited visually inside the editor rather than written as raw syntax.

More detail on the feature is available in [our support article](https://support.topol.io/en/articles/10938892-structure-variants-and-conditions).

## Enabling conditional content

Add the following option to `TOPOL_OPTIONS`:

```ts
enableSectionVariants: true,
```

This setting unlocks the UI for adding and managing conditional variants of sections directly inside the editor interface.

### Adding and managing section variants

-   **Add structure variant**

![Variants](https://docs.topol.io/variants/variants-1.png)

-   **Add condition for certain variant**

![Variants](https://docs.topol.io/variants/variants-2.png)

-   **Switch between variants and edit its content**

![Variants](https://docs.topol.io/variants/variants-3.png)

Conditions play very nice together with [Merge Tag Previews](https://docs.topol.io/email-editor/guide/merge-tag-previews.html).

## Conditional syntax

The generated syntax is compatible with Mailchimp and SparkPost, selected through `emailServiceProvider`:

```ts
emailServiceProvider: 'mailchimp' | 'sparkpost',
```

We are eager to expand our compatibility with additional providers. If you have a specific provider in mind, please reach out to our support team with your request.

## Comparators

Each condition combines a Merge Tag, a comparator and a value. Seven comparators are available:

| Comparator | Meaning |
| --- | --- |
| `is` | Value matches exactly |
| `is not` | Value does not match |
| `exist` | The Merge Tag is present (hides the value field) |
| `>` `<` `>=` `<=` | Numeric comparisons |

The four numeric comparators can be removed from the picker, leaving only `is`, `is not` and `exist`:

```ts
disableExtendedComparators: true,
```

## Chaining conditions

Chaining connects several conditions on one variant with `AND` or `OR`. It is controlled by `logicalOperatorsInsideVariant`, and **both providers support it**:

```ts
logicalOperatorsInsideVariant: true,
```

![Variants](https://docs.topol.io/sparkpost-conditional-chaining.png)

When the option is left unset, SparkPost turns chaining on and Mailchimp leaves it off. Setting it explicitly overrides that default in either direction.

## Merge tag-specific autosuggestions

Autosuggestions offer known values for a Merge Tag while a condition is being written, which cuts down on typos. Define them by adding a `suggestions` array to the Merge Tag configuration, so each Merge Tag carries its own list:

```ts
{
  value: "*|COUNTRY|*",
  text: "Country",
  label: "Free Shipping Countries",
  // available suggestions for this specific Merge Tag
  suggestions: ['USA','Germany','France','Spain'],
},
```

The dropdown opens once a Merge Tag is selected and the user starts typing in the value field, or clicks the caret icon inside it. Suggestions are a convenience rather than a constraint, so any other value can still be typed in.

![Merge tag autocomplete](https://docs.topol.io/variants/variants-MT-specific-autosuggestion.png)

For more information about Merge Tags, visit [this documentation](https://docs.topol.io/email-editor/guide/merge-tags.html#merge-tags).

## Language-based variants

When using [multilingual templates](https://docs.topol.io/email-editor/guide/multilingual-templates.html), a variant can be limited to specific languages, which suits a section that belongs in one language but not the others.

With `multilingual` enabled and **two or more languages** on the template, a language merge tag is added to the variant condition autocomplete. Its default name is `TOPOL_TEMPLATE_LANG`.

To create a language-based variant:

1.  Add a variant to a section
2.  Type `TOPOL_TEMPLATE_LANG` into the condition field
3.  Choose the language code from the suggested values (e.g., `cs`, `en`, `de`)

The suggested values come from the languages configured on the template. Selecting one also switches the editor to that language, so the variant is edited in context.

### Custom language merge tag

The merge tag name is configurable via `TOPOL_OPTIONS`:

```ts
languageMergeTag: 'MY_CUSTOM_LANG_TAG',
```

If not set, the default value is `TOPOL_TEMPLATE_LANG`.

When sending emails, set the value of this merge tag to the recipient's language code to control which variant is displayed.
