Skip to main content

Is there anyway to have a neater formatting option when pulling in event items into an SMS flow? For example in the screenshot attached - the array of line items {{ event.Items|default:'' }} is pulled in ] and product names in ‘’. However, when puling in a single event item {{ event.Items.0|default:'' }} it looks much neater.

Is there a way to make the array of items (red box) to be formatted like the single event item (green box)?

 

Hello @Jemma,

Welcome to the Klaviyo Community!

Great question! When using the {{ event.Items|default:'' }} variable, those brackets and single quotes are meant to designate that the data type of the value is in a list format. Instead, I would suggest calling each item in the array individually. 

No matter which option you use, you can also use code logic such as if/else statements to better format your variable responses too! Our template expert, @Anna McCarthy has a great tutorial on this in the community post below:

I hope this helps!

Davd


Thank you so much for your response @David To!
In my particular use case I am setting up an order confirmation SMS so calling each item in an array won’t work, however, do they if/endif statements work for events, not just profile properties?

Thank you!


Hey @Jemma,

If/endif statements (logic) would certainly work with events. They’re not just limited to profile properties! 

David


Thank you so much for your help @David To


Reply