Brevo allows you to design email templates and campaigns that display unique content elements to different recipient depending on the conditions you set.
We have divided this topic in 3 articles. In this third article, we will explain how to show or hide blocks of content based on repeatable blocks.
- Show or hide blocks based on contact attributes
- Show or hide blocks based on transactional parameters
- Show or hide blocks based on repeatable blocks - YOU ARE HERE
Before you start
- Make sure you are familiar with the Repeat block feature. Learn more about it in our dedicated article: Repeat a block of items in your emails.
Display specific content to different recipients based on repeatable blocks
Block visibility based on repeatable blocks allows you to display a specific block (image, title, text, etc.) based on the conditions you set for a repeatable block.
When using the Repeat block option in an email campaign or template, you may choose to display a block when conditions within the block are met. This is very useful when you only want to display a repeatable bloc only if it contains your desirable elements.
Let's imagine that we want to create an email confirming when items in an order have shipped that includes the option to separately list any items on back order. This email would contain:
- A list with the items that were shipped
- A list with the items that are back ordered and will be shipped later
Personalize your email based on repeatable blocks
The procedure is different according to the editor you're using. Display specific content to different recipients based on repeatable blocks:
|
|
[New design] Drag & Drop Editor |
[Classic design] Drag & Drop Editor |
The Show or hide block option is only available to use based on contact attributes and transactional parameters in the New Drag & Drop Editor.
However, you can still manage the visibility of blocks based on repeatable blocks by manually inserting the if tag in your email template. To learn more about how to use the if tag in an email template to hide or show a block, refer to our dedicated article: Customize your emails with "IF" conditions.
To create the above email:
- In a first block, use the Repeat block feature for the shipped products
- Select this block and enable the Show or hide block feature
- In the first drop-down list, select Dynamic list variable
- In the Key field, enter the name of the key you want to display the block based on. In our example, we have entered a key called "shipped". When the template detects a "yes" value for this key, it will display the block list with all shipped products.
- In a second block, use the Repeat block feature for the products that will be shipped later
- Select this block and enable the Show or hide blocks feature
- In the first drop-down list, select Dynamic list variable
- In the Key field, enter the name of the key you want to display the block based on. In our example, we have entered the same key called "shipped". When the template detects a "no" value, it will display the block list with all products that will ship later.
If you are unfamiliar with the elements in a FOR tag, this color-coded reference may help you correctly place each element in your email campaign or template:
To create the example email showed above, we pasted the following in our API v3 call to send a transactional email:
⏩ What's next?
- Show or hide blocks based on contact attributes
- Show or hide blocks based on transactional parameters
- Test your emails customized with Brevo Template Language
- Troubleshoot your emails customized with Brevo Template Language
🤔 Have a question?
If you have a question, feel free to contact our support team by creating a ticket from your account. If you don't have an account yet, you can contact us here.