The Block Repeat Feature



The block repeat feature allows you to insert a single block that will automatically repeat itself and iterate over all entries within a single variable. To turn on this block repeat feature for a given block, click the gray hamburger icon at the very top of a block.

If you are unfamiliar with using event variables in emails, check out this guide as a first step.

Why Use the Block Repeat Feature

When you click this icon, a small window will pop up that prompts you to specify an event variable to "loop over" (i.e. repeat) as well as an alias you can use in your template.

In the example below, you will see there are three items in the previewed order:

The variable for the "Blue" item is {{ event.Items.0 }}

The variable for the "Klaviyo Green Tee" item is {{ event.Items.1 }}

The variable for the "Purple" item is {{ event.Items.2 }}


So, what happens if you want to iterate over all items in an order, and not just include a variable for a single line item? There are two ways to approach this:

  1. Use the block repeat feature available within the template editor
  2. Build a dynamic table in your template

Here, we're going to explore the how to achieve this with the block repeat feature. Keep in mind that this is just one example use-case. You can use this block feature to iterate over any variables that have multiple entries.

Using the Block Repeat Feature

Example #1

In the example above, you see that we have:

  • {{ event.Items.0 }}
  • {{ event.Items.1 }}
  • {{ event.Items.2 }}

The variable itself is event.Items and we want to loop over this variable so that event.Items.0, event.Items.1, and event.Items.2 will populate in our template.

In this example, the Repeat For variable is event.Items.

We can then assign this an alias - let's assign the alias as item. Then, we can say, loop over every "item" in  event.Items.


After clicking to turn this block feature ON, and clicking Save, you will see the feature icon change to blue.

We can then insert the variable alias {{ item }} into this text block and save it. When you preview your template, you will see that all value entries will populate as the specified variable is looped over. 

While this alias will appear as {{ item }} in your template, when you preview the email, it will look something like this:



Bear in mind that you can format these variables however you'd like, as well as include additional variables using the same process.

One thing to note is that it's important to only place the variables you want to loop over within the text block that has the block repeat feature enabled. In the above example, the text "Don't forget that all domestic shipping is free, and we offer expedited shipping at the exact price we pay - no markup" is separated into a different text block so that it only displays once, and doesn't repeat along with the variables.


Was this article helpful?
1 out of 2 found this helpful