Skip to main content
Solved

Help with Dynamic Product Data for Last Placed Order in Replenishment Flow


Forum|alt.badge.img+2

Hi Klaviyo Community!

I’m setting up a replenishment flow that is triggered by the Placed order  event with a 30-day delay to remind customers to repurchase. Since we sell multiple products with different combinations, using conditional splits isn’t ideal.

I want to dynamically pull in the products from each customer’s last order and display them in the email.

Ideally, this would include: Product name, quantity, image.

I've tried various dynamic Liquid code variations using event.line_items, but none of them are working. When I preview the email with real profiles, the product details do not appear—there’s no information about what they ordered, including quantity, items, or prices.

I would really appreciate help regarding:

  1. What is the correct Liquid code to dynamically pull in each product from the last order in a row collection?
  2. How can I confirm that line_items (or a similar field) is available in the Placed Order event?
  3. If Shopify isn’t passing product details correctly, how can I fix the integration so that Klaviyo receives full order data? I believe they are correctly synced, but again, when I preview the email with real profiles, none of the information I need appears. 

Any guidance would be greatly appreciated! Thanks in advance. 😊

 

Best answer by In the Inbox

Hi ​@ivaaem 

Welcome to the Klaviyo community and thank you for posting your question. I hope I can help. 

I recently set up a replenishment flow similarly to what you described for yours:

  • Placed order trigger
  • 30-day wait step
  • Dynamically show all items from the previous order

My suspicion for the issue you are encountering is that you haven’t configured the block/table to repeat based on the right conditions. But, let’s confirm. 

For the block/section you set up to display the product name, quantity, and image–on the left-hand menu, when you click on “Display” can you confirm you have enabled the Content Repeat section to:

Repeat for: event.extra.line_items

Item alias: item
 

 

For the Shopify Placed Order event, in order to loop content to repeat for all items in the event, you’d need to configure this as shown. 

In the actual block within the email body, I use a section, but you could be using a table, or other element block. 

Here is how I have set each of the product attributes:

Image: Use a Dynamic Image with the dynamic variable set to: {{ item.product.images.0.src }}

Product Name: {{ item.product.title }}

Product Quantity: {{ item.quantity|floatformat:0 }} 

I have added a floatformat to eliminate any decimal places from the data coming in from our Shopify.

 

To find all possible dynamic data from the Placed Order event, when you preview your email by clicking the Preview & test button, Klaviyo pulls in 10 recent customer data for that event. If you click on any attribute in the list, Klaviyo copies that token to your clipboard. 

Let’s say, I want to also include the coupon code the user previously used. In the placed order event I can see the Discount Codes value:

 

 

If you click on “Discount Codes” you’ll see Klaviyo gives you an alert that says:

 

In this case, {{event|lookup:’Discount Codes’ }} is the dynamic variable to pull in that value into the email. 

But first, double check you have the repeat content enabled and configured above and see if that resolves the issue with your products not showing.

Of course, once you review your email, if you are still running into issues, please let me know (and include as many screenshots as possible of the setup, to further troubleshoot).

 

I hope this helps!

@In the Inbox 

 

View original
Did this topic or the replies in the thread help you find an answer to your question?

5 replies

In the Inbox
Partner - Platinum
Forum|alt.badge.img+31
  • 2025 Champion
  • 289 replies
  • Answer
  • February 5, 2025

Hi ​@ivaaem 

Welcome to the Klaviyo community and thank you for posting your question. I hope I can help. 

I recently set up a replenishment flow similarly to what you described for yours:

  • Placed order trigger
  • 30-day wait step
  • Dynamically show all items from the previous order

My suspicion for the issue you are encountering is that you haven’t configured the block/table to repeat based on the right conditions. But, let’s confirm. 

For the block/section you set up to display the product name, quantity, and image–on the left-hand menu, when you click on “Display” can you confirm you have enabled the Content Repeat section to:

Repeat for: event.extra.line_items

Item alias: item
 

 

For the Shopify Placed Order event, in order to loop content to repeat for all items in the event, you’d need to configure this as shown. 

In the actual block within the email body, I use a section, but you could be using a table, or other element block. 

Here is how I have set each of the product attributes:

Image: Use a Dynamic Image with the dynamic variable set to: {{ item.product.images.0.src }}

Product Name: {{ item.product.title }}

Product Quantity: {{ item.quantity|floatformat:0 }} 

I have added a floatformat to eliminate any decimal places from the data coming in from our Shopify.

 

To find all possible dynamic data from the Placed Order event, when you preview your email by clicking the Preview & test button, Klaviyo pulls in 10 recent customer data for that event. If you click on any attribute in the list, Klaviyo copies that token to your clipboard. 

Let’s say, I want to also include the coupon code the user previously used. In the placed order event I can see the Discount Codes value:

 

 

If you click on “Discount Codes” you’ll see Klaviyo gives you an alert that says:

 

In this case, {{event|lookup:’Discount Codes’ }} is the dynamic variable to pull in that value into the email. 

But first, double check you have the repeat content enabled and configured above and see if that resolves the issue with your products not showing.

Of course, once you review your email, if you are still running into issues, please let me know (and include as many screenshots as possible of the setup, to further troubleshoot).

 

I hope this helps!

@In the Inbox 

 


MANSIR2094
Problem Solver IV
Forum|alt.badge.img+13
  • Problem Solver IV
  • 184 replies
  • February 5, 2025

Hello ​@ivaaem ,

Since you want to dynamically pull product details from each customer’s last order into your replenishment flow, you need to ensure that Klaviyo is correctly receiving and processing order data from Shopify. First, verify that the Placed Order event includes `event.line_items` by navigating to Analytics > Metrics > Placed Order in Klaviyo, selecting a recent event, and expanding its data to confirm if product details such as name, image, and quantity are present. If this data is missing, recheck your Shopify integration settings under Integrations > Shopify and ensure order data syncing is enabled.

If the data is available but not displaying correctly in your email, ensure that your Liquid syntax correctly loops through `event.line_items`. The correct Liquid code should be:

```liquid
{% for item in event.line_items %}
   <p><strong>{{ item.product.title }}</strong></p>
   <p>Quantity: {{ item.quantity }}</p>
   <img src="{{ item.product.image }}" alt="{{ item.product.title }}" width="150">
{% endfor %}
```

Use the Preview & Test feature in Klaviyo’s email editor, selecting a profile with a recent purchase to check if the order details populate correctly. If the preview remains empty, Shopify might not be passing complete order data. In that case, re-sync your integration by going to Shopify Admin > Settings > Notifications and ensuring that Klaviyo is listed as a webhook receiver for order events. You may also manually trigger a sync under Integrations > Shopify > Sync Past Data in Klaviyo.

If the issue persists, test the Liquid code by outputting `{{ event | json }}` inside your email template to inspect the raw event data and confirm the correct key names for accessing order details. If adjustments are needed, modify the Liquid syntax accordingly. Let me know if you need further assistance in troubleshooting this issue.


emma.owens
Community Manager
Forum|alt.badge.img+9
  • Community Manager
  • 42 replies
  • February 5, 2025

Hi ​@ivaaem ! 

Thank you for reaching out to the Community - it looks like you have gotten two great solutions above. Here are the specific steps I would recommend taking to ensure that the email is pulling in all items in a customers placed order event: 

  1. Drag a table block into your email and set the table to ‘Dynamic’. Here, you can input the row collection as ‘event.extra.line_items’ and the row alias as ‘item’
  1. Identify the image URL in the event details and make sure to replace the row collection with the row alias - for Shopify Placed Order you’ll want to use {{ item.product.images.0.src|default:'' }}. Input this variable into the ‘Dynamic image’ tab: 
  1. Input the product name variable and quantity variable into the text block section of the table. Here are the correct variables to use: 

    {{ item.name|default:'' }} Quantity: {{ item.quantity|floatformat:0 }} 

  1. Here is what the table should look like when completed: 

 

 


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 1 reply
  • February 7, 2025

Thank you all for your detailed responses! 


MANSIR2094
Problem Solver IV
Forum|alt.badge.img+13
  • Problem Solver IV
  • 184 replies
  • February 7, 2025

You are welcome 🤗 hope you were able to resolve it?