Solved

Transactional SMS - Event Items

  • 24 July 2023
  • 4 replies
  • 103 views

Badge

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)?

 

icon

Best answer by David To 24 July 2023, 17:16

View original

4 replies

Badge

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!

Userlevel 7
Badge +60

Hey @Jemma,

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

David

Badge

Thank you so much for your help @David To

Userlevel 7
Badge +60

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

Reply