Expand my Community achievements bar.

Dive in, experiment, and see how our AI Assistant Content Accelerator can transform your workflows with personalized, efficient content solutions through our newly designed playground experience.
SOLVED

abandon basket - multiple products - iteration in email

Avatar

Level 8

Suppose that user have multiple products in the cart. How to iterate in email designer through every product (through productListItems) and put multiple product names in the design.

 

I have got something like this for now:

Michael_Soprano_0-1716289004040.png

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

Take a look at this example in the documentation https://experienceleague.adobe.com/en/docs/journey-optimizer/using/content-management/personalizatio...

 

Iteration is using the following "each" helper

 

{{#each context.journey.events.event_ID.productListItems as |product|}}
   <table>
      <tbody>
         <tr>
            <td><b>{{product.name}}</b></td>
            <td><b>{{product.quantity}}</b></td>
            <td><b>${{product.priceTotal}}</b></td>
         </tr>
      </tbody>
   </table>
{{/each}}

 

 

View solution in original post

6 Replies

Avatar

Correct answer by
Employee

Take a look at this example in the documentation https://experienceleague.adobe.com/en/docs/journey-optimizer/using/content-management/personalizatio...

 

Iteration is using the following "each" helper

 

{{#each context.journey.events.event_ID.productListItems as |product|}}
   <table>
      <tbody>
         <tr>
            <td><b>{{product.name}}</b></td>
            <td><b>{{product.quantity}}</b></td>
            <td><b>${{product.priceTotal}}</b></td>
         </tr>
      </tbody>
   </table>
{{/each}}

 

 

Avatar

Community Advisor

@Michael_Soprano Small correction to the response posted by dugganab.

 

{{#each context.journey.events.event_ID.productListItems as |product|}}
<table>
<tbody>
<tr>
<td><b>{{product.name}}</b></td>
<td><b>{{product.quantity}}</b></td>
<td><b>${{product.priceTotal}}</b></td>
</tr>
</tbody>
</table>
{{/each}}

Thanks, Sathees

Avatar

Level 8

Do you know how to debug what productListItems array contains using front-end?

Even though I used your example I still have only one last product in mail ...

Avatar

Community Advisor

@Michael_Soprano Use the journey test mode to test and specify more than one item to see how it works. Also, have a look at this similar post on how to get productlistitems data to display in the front end.

Thanks, Sathees

Avatar

Employee

You can switch to code view in test mode and specify multiple objects in the productListItems array to validate if these are being shown in the email content.

 

For example - 

 

  "productListItems": [
		{
			"name": "Sprite Yoga Companion Kit",
			"priceTotal": 61,
			"quantity": 1,
			"SKU": "24-WG080"
		},
		{
			"name": "Nike Air Max",
			"priceTotal": 200,
			"quantity": 2,
			"SKU": "31-YG010"
		}
	]