Forum Discussion
Personalization with Liquid using purchase events on order level
Hello, I am trying to personalize an email based on purchase event on order level.
Here it says that event properties schema could not be generated for purchase events, but that the nested data is supported by purchase events. Is nested objects even supported for purchase events on order level?
This is the event that I am using:
{
"purchases": [
{
"external_id": "2023_new",
"product_id": "Completed Order",
"currency": "USD",
"price": 219.98,
"properties": {
"products": [
{
"name": "Monitor",
"category": "Gaming",
"product_amount": 19.99
},
{
"name": "Gaming Keyboard",
"category": "Gaming ",
"product_amount": 199.99
}
]
},
"time": "2024-06-20T13:59:30+01:00"
}
]
}
So can you please clarify how can we add liquid tag in order to display the name of the first product - "Monitor"?
Looking forward for your reply!
Many thanks
Hi inespais , it finally worked with this piece of code in the email template.
{{event_properties.${products}[0].name}} {{canvas_entry_properties.${products}[0].name}}
- inespaisPractitioner II
HI elena14 - if your JSON event data structure is like the one shown above, you will need to use dot notation to access the nested data. Please try the following and see if it works:
To display the name of the first product:{{purchases[0].properties.products[0].name}}
To display the name of the second product:
{{purchases[0].properties.products[1].name}}
and so on...
Related Content
- 7 months ago