Personalisation using a loop

Make your work easier by automatically listing the elements of a product.

Marek Szwed avatar
Written by Marek Szwed
Updated over a week ago

It may happen that you want to list several items from a given object (e.g. products from an abandoned cart) but these items are too long to list manually. For this case, you can use a loop and have all the elements listed automatically.

The loop starts with the merge tag *|EACH:FIELD|*, where you replace 'FIELD' with the name of the object you want to list the elements from, and always ends with the merge tag with *|END|*.

The loop is then written the same as the merge tag + the element of the object you want to list.


The loop can be used on transactions, an abandoned cart, or transactional emails.


As an example, let's list all products from the abandoned cart. Elements from the cart are for example name, price, description, img_url etc. So we write them after the loop_var element:

*|loop_var.price|* Kč

The loop is executed as many times as the search object occurs for a given contact. For example, if a contact has 3 products in an abandoned cart, this is information for the loop to run 3 times. Your content will then also be listed 3 times.

It will then look like this:

The content will be stacked below - this cannot be changed.

💡Text formatting is taken from the merge tag format. So if you want the product name in bold, change the merge tag of the name to bold.

Using loops in transactional emails

To use the loop function in a transactional email, follow the instructions above in the template and attach the appropriate data to the request in the field as follows:

"global_merge_vars": [
"product": [
"name": "Chair",
"description": "Wooden chair",
"price": 899
"name": "Table",
"description": "Wooden table",
"price": 1499

Did this answer your question?