What are the correct codes to show someone what was in their checkout and take them directly to checkout?
Cheers
Page 1 / 1
Hello @kellycous93,
You're on the right track, but the issue is likely that the event data structure for "Checkout Started" is different from "Abandoned Cart" in Klaviyo. The correct variables depend on how Shopify sends the data. Try using the following:
1. Correct the Image, Product Name, Price, and Checkout Link
Replace your current code with this:
{% for item in event.extra.line_items %} **Product:** {{ item.product.title }} **Price:** {% currency_format item.line_price %} **Image:** <img src="{{ item.product.images.0.src }}" alt="{{ item.product.title }}" width="200"/> **Link to Checkout:** *Return to Checkout]({{ event.extra.checkout_url }}) {% endfor %}
2. Explanation of Fixes:
event.extra.line_items → Loops through all products in the abandoned checkout.
item.product.title → Displays the product name.
item.line_price → Formats the price correctly.
item.product.images.0.src → Grabs the first product image.
event.extra.checkout_url → Directs the user back to their checkout.
3. Next Steps
Test this in Klaviyo's "Preview" mode to confirm the correct data is pulling in.
If images still don’t appear, check Shopify’s event data to ensure images are included in the webhook.
Kindly reach out if you need adjustments.
Best Regards,
Hi, thanks for your response but that didn’t work for me :(
Hi @kellycous93,
Great question! The issue is that the event data in your abandoned checkout flow is different from the abandoned cart flow. The correct way to display product details in your abandoned checkout emails is to use the right event properties. Try this updated version:
This will dynamically pull in the first product from the abandoned checkout and link the customer back to their checkout session. If you want to show multiple products, you need to loop through event.extra.line_items.
Let me know if you need further clarification!
Cheers, Adunni
I don’t know what I am doing wrong, but that’s not working either :(
Hi @kellycous93
Thank you for posting in the Community!
First of all, is your flow being triggered of the Added to Cart or the Started Checkout metric in Shopify?
If it is the Added to cart you can try setting in these variables:
Image URL: {{ event.ImageURL|default:'' }}
Product Name: {{ event.Name|default:'' }}
Product URL: {{ event.URL|default:'' }}
Price: {{ event.Price|default:'' }}
If it is the Started checkout metric it will dynamically pull in all products in the cart, therefore you should setup a table with row collection and row alias as shown below. From there, you can pull in the attributes:
Image URL: {% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src|missing_product_image}}{%endif%}