How to Build Dynamic Blocks in a Flow Email

Last updated at:


Within a flow, you’re able to personalize the content of your emails based on the event that triggers the flow. For example, if someone starts a checkout, you can include product images and prices within an abandoned cart email to encourage recipients to return to their cart and finish their purchase.

While Klaviyo comes prepopulated with a handful of built-in dynamic blocks within the emails in the flow library, you can build out and customize these blocks on your own as well.

In this article, we’re going to build out an abandoned cart dynamic block as an example of how you can use event data within a flow email.

Before You Start

Before you can jump in, you’ll want to make sure that you have an ecommerce integration enabled with Klaviyo. If you're building out the abandoned cart example, and if you’re using a custom integration, make sure it's pulling in checkout started data. If you’re using a built-in integration (i.e. BigCommerce, WooCommerce, Magento, Shopify, etc.), the integration will pull in this information automatically.

Create Your Flow

First, you must create a flow that is triggered by an event (or metric). In this example, because we are building an abandoned cart block, we need our flow to be trigged by the Checkout Started event. This ensures that we have access to the event data necessary to construct an abandoned cart block.


You can customize any of your flow emails using this same process, but you’ll have to change the metric to have access to other information being pulled into Klaviyo. For example, if you would like to include information in a post-purchase email about the item someone bought, you will need to make sure that the flow is triggered by the Placed Order event.

From there, you can drag and drop an email into the flow, and customize it.

Create the Dynamic Block

Once you’re inside of the email editor, drag in a table block. Select Rows > Dynamic > Save.


To understand the different types of data you can work with, preview the email. Scroll through the available data to choose the dynamic information that you would like to display. For this example, we want to display the items the customer abandoned in their cart.


After copying the desired data, head back into the data block. Because someone may have multiple items in their cart, we need to make sure that the data source is repeated. This ensures that every item someone has in their cart is displayed.


To do this, navigate to the Data Source section of the table. Row Collection refers to the data that we want to be repeated multiple times. Row Alias is used to refer to whatever data we want to be repeated. So, in this case, event.extra.line becomes item. Within the tag, {{ event.extra.line_items.0.product.images.0.src }} becomes {{ item.product.images.0.src }}.


Next, you’ll need a placeholder image for each item left in the cart. This enables you to include an image of the items someone has abandoned.


To do this, within the table, select Column 1 and choose image. Instead of selecting a particular image from your library, insert a snippet of code — {{ item.product.images.0.src }} — so that each item will have a corresponding image.


Preview the email to ensure that the images are populating correctly. If the preview looks as you expect, you can then add in the item and price in the column next to the image.

Item - {{ item.product.title }}
Price - {{ item.price }}


After you’ve entered the information, preview the email again to ensure it looks as you expect.


You can use these same concepts to build out additional dynamic blocks for flows triggered based on different metrics.


To recap:

  1. Create a flow triggered off of metrics pulling in.
  2. Set your block to be dynamic.
  3. Preview the email to get the event data that you want to use.
  4. In the Data Source, enter the row collection and row alias.
  5. Place in a placeholder image, if desired.
  6. Add in the image title and price, if desired.
  7. Preview

Additional Resources

Was this article helpful?
69 out of 122 found this helpful