Overview
This guide walks through multiple ways to power abandoned cart reminders in OneSignal. You’ll learn how to sync cart data and personalize emails or push notifications when users leave items behind. You can power abandoned cart templates with:- API
custom_data
— pass cart details inline with your message request. - Tags — store key-value pairs to personalize messages.
- Custom Events (Early Access) — trigger Journeys from user events like
cart_updated
. - Data Feeds — pull real-time cart data directly from your API at message send time.
Setup examples
Use the Create Message API with the 

The Text blocks of the 2nd, 3rd, and 4th columns will have the text:


In this example, we first assign the variable
custom_data
property to inject cart data stored on your server. Best for server-side controlled cart data.Example custom_data
payload:JSON
Abandoned cart email template
This email template example demonstrates how to display thecart
items Using Liquid Syntax:- Total number of items in the cart
- Items in the user’s cart including:
- Product image
- Product name
- Product quantity
- Product price
- Link to the customer’s personalized cart URL

Abandoned cart email template example
Email template setup
1
Create a new email template
Navigate to Messages > Templates > New Email Template.
2
Use the Drag & Drop Editor
3
Create a 5 rows with the following:
- Rows 1, 2, and 4 have 1 column with a Text block.
- Row 3 has has 4 columns with: HTML block | Text block | Text block | Text block
- Row 5 has 1 column with a Button block

Abandoned cart email template setup
Display item count in email
Using Liquid syntax, show the number of products using thesize
property.
Within your template row 1 Text block, set your copy as desired.Example:Display items in email
Use a Liquid for-loop to iterate over yourcustom_data
cart array.Within template row 2 Text block, set: {% for product in message.custom_data.cart %}
which starts the for-loop.Row 3 with the 4 columns will have the following in the 1st column’s HTML block:{{product.cartProductName}}
{{product.cartQuantity}}
{{product.cartPrice}}
{% endfor %}
The for-loop checks each product
in the cart
array we pass into custom_data
and displays the value for each product in the columns.
Abandoned cart email template example to show items
Add a custom cart URL in email
This is optional and only needed if your carts are custom to a specific URL per customer.There are several ways to setup the cart URL. In this example we pass in the full URL to the cart within thecustom_data
: "cart_url": "https://yourdomain.com/cart"
See Dynamic URLs for more details.In the Button block > Content Properties > Action > Url, set {{message.custom_data.cart_url}}

Abandoned cart email template example for custom URL
Finalize the email template
See Design Emails with Drag and Drop for more details on customizing the template.When ready, you can use the
template_id
within your Create message API requests with custom_data
property.Abandoned Cart Push template
This push template example will demonstrate how to display an item in the user’s cart including its image and name. It also displays how many items total are in the cart and links to the customer’s personalized cart URL.
Abandoned cart push template example
Push Template Setup
Push notifications can only be sent with a limited amount of data. Instead of listing all items in the cart, we want to display the first item and mention how many total items there are.Navigate to Messages > Templates > New Push TemplateDisplay item and item count in push
Liquid syntax provides if statements we can use to change what the message says depending on how many items in thecart
array of your custom_data
object.In the template Message field, add the following copy:cart
to be the custom_data.cart
, then assign the variable item_count
to be the cart.size
, and, if that count is equal to 1, 2 or more than 2, display different content.Due to the cart possibly having more than 1 item, we use the first
property to get the first item in the cart.We use the minus
feature to reduce the total cart items count by 1 since we mention it already.Display item image in push
In the template Image field, add the Image URL property with the liquid syntax. If the image doesn’t exist, then no image will show. You can set adefault
image as well. Example:Add a custom cart URL in push
In the template Launch URL field, add the cart URL property with the liquid syntax. If the cart doesn’t exist, then the push will direct to the home page of the site or app.Note on Launch URL within Templates: settinghttps://
or some other schema in the format x://
is required. If you set this within the data, you can use the remove
feature of liquid syntax as follows:https://{{message.custom_data.cart_url | remove: "https://"}}
Update the push template and send the message
See Sending Messages for more details on options provided within push templates.When ready, you can use the
template_id
within your Create message API requests with custom_data
property.Need help?Chat with our Support team or email
support@onesignal.com
Please include:- Details of the issue you’re experiencing and steps to reproduce if available
- Your OneSignal App ID
- The External ID or Subscription ID if applicable
- The URL to the message you tested in the OneSignal Dashboard if applicable
- Any relevant logs or error messages