How can I show just part of an event variable that’s around 4-5 words? For example, the product title variable {{ event.extra.line_items.0.product.title }} is 6 words but I only want to show the first 3.
Limiting the number of items in an array
Best answer by Dov
Hi
Thanks for sharing this question with the Klaviyo Community.
You can use the “slice” filter to limit how many items from the list are displayed. This is a Django template language filter which you can learn more about here: Built-in template tags and filters | Django documentation | Django.
You apply this filter to the value in the Row Collection field in the Rows > Data Source section of the table block.

Since you want to limit the list to only showing the first 3 items and the value is event.extra.line_items it should then be changed to event.extra.line_items|slice:'3' where the number, in this case 3, is how many items you would like to display.
Thank you and have a great weekend.
Log in to the Community
Use your Klaviyo credentials
Log in with Klaviyo
Use your Klaviyo credentials
Log in with KlaviyoEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.



