In this article, we will explain how to use the Repeat block feature to insert a single block of items that will automatically repeat itself and iterate over all items within a single variable.
You can repeat a block in:
- an email receipt email to display all the items your client has purchased,
- an abandoned cart email to display all the items that were left in your client's cart,
- an RSS campaign to automatically display a series of blog articles,
- etc.
Before you start
- If you are unfamiliar with using transactional parameters to customize emails, check out our dedicated article Customize your emails using transactional parameters as a first step.
What is the Repeat block feature?
To repeat a block, you have two options:
- Use the Repeat block feature available within the Drag & Drop editor — this is the method we explain in this article.
- (Advanced) Manually add for-loops using the for tag in your email templates.
Thanks to the Repeat block feature, you can add lists of items within a single block in your emails. For example, you can send an abandoned cart email with the list of items left in your client's cart or an order confirmation with all the items your client just bought.
The Repeat block feature works as follows:
- You insert transactional parameters placeholders in an email template, e.g. {{ item.name }} and {{ item.price }}.
- The transactional parameters are retrieved through an API call or through an Automation workflow triggered by an event.
- The placeholders are dynamically populated with information specific to each recipient during the sending of the transactional email. The pattern will be repeated for as many items as you'd like, and the number of items displayed will adapt in each email.
Here is an example of what a repeatable block looks like in the Drag & Drop Editor and what it can look like once populated with the data of a recipient who purchased 4 items:
Step 1: Insert your transactional parameters placeholders
You first need to decide what transactional parameters placeholders you want to add to your email. It can be the name and price of products purchased by your clients, the shipping costs, etc.
To insert your transactional parameters placeholders in your email template:
- Drag and drop a Text block into your email template.
- Within the body of the text, type in the transactional parameters placeholders that correspond to the information that you want to mention in your email (name, price, variant, etc.).
Find the list of predefined transactional parameters placeholders to use in your emails in Customize your emails using transactional parameters.
Step 2: Repeat a block
The procedure is different according to the editor you're using:
1️⃣ Enable the Repeat block feature
To enable the Repeat block feature in your email template:
- Once you have added your placeholders, hover over the block you want to repeat.
- Click the Repeat block icon.💡 Good to knowMake sure you hover over the block. If you click inside the block, the Repeat block option won't be available.
2️⃣ Fill in the repeatable block information
- In the Repeat for field, input the plural version of the first word of your placeholder, e.g. for the section containing the placeholder {{ item.name }} enter items. If you have connected your website to Sendinblue using one of our plugins, the name is items by default.
- In the Variable alias field, input the first word in your placeholder, e.g. for the section containing {{ item.name }} the variable is item. If you have connected your website to Sendinblue using one of our plugins, the name is item by default.
If you are not using a Sendinblue plugin or if you are using other transactional parameters, you can find this information in your event logs. Learn how to find this data in our article Customize your emails using transactional parameters.
3️⃣ Set a limit of items
If necessary, you can choose to limit the number of items displayed in the emails sent. To do so, input the number of maximum items you want to display in the Limit field.
4️⃣ Save your template
After filling out the repeat block pop-up window, click Add loop to save it. The Repeat block icon of your block becomes green when active:
⏩ What's next?
- Customize your emails with "IF" conditions
- Customize your emails using transactional parameters
- Test your emails customized with Sendinblue Template Language
- Troubleshoot your emails customized with Sendinblue 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.