cancel
Showing results for 
Search instead for 
Did you mean: 

How to loop products from added_item_to_cart events in an email?

Manoj__
Practitioner III

Hello Experts,

I am building my first canvas journey in Braze for an Abandoned cart use case. I am using an email channel as a message in this use case.

In my scenario, I have added 2 products to the cart and I want to print those two products by email.

The issue I am facing is how to print these products via event using a for loop.

I have tried Advanced Event Properties. But It just prints item_name. How do we know which item it is from the event? There could be 2 or more products in the event

Manoj___0-1701916351543.png

The learning section here only shows the push notification which is easy to configure.

 

 

9 REPLIES 9

bob
Specialist

@Manoj__ , I'd be interested if you made progress with this - I was scrolling back through posts after not being around for a while.

Do you know what the structure of your added_item_to_cart event is? So far as I know there's no standard definition of which attributes should be populated, so the answer to this is going to be dependant on what your data looks like.

Manoj__
Practitioner III

Hello @bob No luck on this one yet. I can't figure out where to start.

I am using the Braze Pilot app to test the platform. My assumption is Abandoned cart is based on on added_item_to_cart event. 

The normal behaviour of a customer is to add products to a cart one by one. And the same way Braze will share this data with Events.
Now if I want to send an Abandoned cart email, How Do I merge these 2 or more event data in a single email?

A workaround could be to wait for some time to create an array on the app and then add this array as a single added_item_to_cart event.

BenLerner-Paio
Specialist

Hey @Manoj__ - just a few questions here:

1.  Is the abandoned cart event a custom event in which you are getting the full readout of the products in the cart? 

2.  Are you sending unique events for each time an item is added to the cart?  This would be problematic as you would not be able to "store" the data from multiple events easily to then be used within an email.

3.  My advice here would be to get the "added_item_to_cart" event to concat and show the full products list added to the cart.  I.e. first event shows apples, second event shows apples, bananas (when bananas was just recently added) and so on.  This would require some changes obviously on the backend / data side.

From there you can just run a for loop in liquid based on the latest event and print them out in the email as needed.   Goes without saying that the trigger for the campaign would be the triggering of the add item event with a delay to give time for additional add item events.  Let me know and Ill see if I can help.

Ishwar_Patidar
Active Member

Hey @Manoj__ If you are still looking for solution, I have a work around for this...

you can have another custom attribute (List_of_cart_items) which would be updated in realtime/batch. Now set your canvas entry as action based and action would be "change custom attribute value", as soon as List_of_cart_items values changed message will be triggered.

for personalization, you just need to run a loop for Array attribute List_of_cart_items and print values based on cart_items using connected content. 

hope it helps.

 

3X Braze Certified