Forum Discussion
Personalization with Liquid using purchase events on order level
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...
Hello inespais ,
I tried your suggestion and unfortunately it is not working. 😐
Do you know what can be the issue here?
- inespais6 months agoPractitioner II
Hey elena14 - are you able to share an example of your JSON event structure? I believe the one above might be taken from Braze's documentation. Even if your's is really similar, a small difference (structure, naming, etc) might be the key here.
- elena146 months agoPractitioner
Hello inespais , Please see the JSON payload here:
{ "purchases": [ { "external_id": "2023_new", "product_id": "Order Level", "currency": "MKD", "price": 230.98, "properties": { "products": [ { "name": "Sunscreen", "category": "Health", "product_amount": 20.09 }, { "name": "Lipstick", "category": "Cosmetics", "product_amount": 25.99 } ] }, "time": "2024-06-24T11:35:30+01:00" } ] }
And this is how the campaign is being set up.
Can it be related to the fact that
- Event property schemas cannot be generated for purchase events.
As it is stated in the documentation here
Many thanks,
Elena
- inespais6 months agoPractitioner II
Hi elena14 apologies if I misread, but my understanding of your original post (I probably just assumed!) was that you wanted to capture the product name for liquid personalization, for which you'd use the schema I suggested:
{{purchases[0].properties.products[0].name}}
If this is for trigger criteria, then I think you could simply try:
properties.name
(also try "is" vs "equals" vs "matches regex" if you have different logic options available)
To be honest I haven't worked with order level purchase events, and this might require some trial and error.
To your point that event property schemas cannot be generated for purchase events - this is definitely confusing in the documentation, but you can definitely trigger campaigns off purchase properties. When Braze mentions that "Event property schemas cannot be generated for purchase events," it means that the specific structure of data for purchase events is fixed and cannot be dynamically generated or altered based on past data, unlike custom events where schemas can adapt based on the data received over the past 24 hours. Essentially, the schema for purchase events is predetermined and not subject to change based on incoming data.
Hope that finally works!
Related Content
- 7 months ago