Skip to main content

I am in the process of creating a flow to notify our new salesperson when a cart with a value of over $5k abandons. I have been pretty successful getting the trigger to work properly and setting up the notification email. All of this info is coming out of our Magento 2 integration. What I am unable to figure out is how to get the items in the customers abandoned cart to appear in the email so that the salesperson is able to see this info before getting in contact with the client. My email template is as follows:


(Salesperson’s name),

A customer with the email address {{ email }} has abandoned a cart with a value over $5,000. Any information gathered is listed below:

value: {{ event|lookup:"$value" }}

items: {{ event.items }}

First name: {{ first_name }}

Last name: {{ last_name }}


 

event.items returns me all of the info for the item in the cart. It shows me internal id’s, meta data, descriptions, etc. I only want it to return the sku and qty of the items in the cart. How can I narrow these results down to just those?

Any help on this is greatly appreciated!😁

To narrow down the results to just the SKU and quantity of the items in the cart, you can use the slice filter and conditional logic in your email template.  Here's how you can modify your template:

(Salesperson’s name),

A customer with the email address {{ email }} has abandoned a cart with a value over $5,000. Any information gathered is listed below:

value: {{ event|lookup:"$value" }}

items: {% for item in event.items|slice:":3" %}
- SKU: {{ item.sku }}
- Quantity: {{ item.quantity }}
{% endfor %}

First name: {{ first_name }}

Last name: {{ last_name }}

This template will loop through the items in the cart and display only the SKU and quantity for each item. The slice filter (|slice:":3") ensures that only the first three items are shown, but you can adjust this number as needed.

Does this help you achieve what you're looking for?


Reply