I am trying to add Variant of a product in the abandoned checkout.
The default setting is for Item quantity but I want to show Variant.
I used {{ event.extra.line_items.0.presentment_variant_title|default:'' }} code for displaying the variant which works for a single product.
But when there are 2 or more products it shows the same weight and count of the variant (picking up the item count from 0)
Can anyone share the correct version of the code so it displays the value of variant related to individual variants and not same for all.
Best answer by ArpitBanjara
Hey @Abd.saif16
Welcome to Klaviyo community
I think you will need to remove the 0 and make use of the repeat for and alias
Let's say you have 3 items, in the event data you would have: {{ event.extra.line_items.0.presentment_variant_title|default:'' }} {{ event.extra.line_items.1.presentment_variant_title|default:'' }} {{ event.extra.line_items.2.presentment_variant_title|default:'' }} Each variable corresponding to each item's presentment_variant_title
So you'll set your repeat for as: event.extra.line_items The alias as: item
And in the template, you'll use: {{ item.presentment_variant_title }}
I think you will need to remove the 0 and make use of the repeat for and alias
Let's say you have 3 items, in the event data you would have: {{ event.extra.line_items.0.presentment_variant_title|default:'' }} {{ event.extra.line_items.1.presentment_variant_title|default:'' }} {{ event.extra.line_items.2.presentment_variant_title|default:'' }} Each variable corresponding to each item's presentment_variant_title
So you'll set your repeat for as: event.extra.line_items The alias as: item
And in the template, you'll use: {{ item.presentment_variant_title }}