Learn how to create abandoned cart reminder templates with OneSignal using custom data, data tags, custom events, or data feeds. Deliver reminders through email and push notifications.
custom_data
— pass cart details inline with your message request.cart_updated
.custom_data
property to inject cart data stored on your server. Best for server-side controlled cart data.Example custom_data
payload:cart
items Using Liquid Syntax:Abandoned cart email template example
Create a new email template
Use the Drag & Drop Editor
Create a 5 rows with the following:
Abandoned cart email template setup
size
property.
Within your template row 1 Text block, set your copy as desired.Example:custom_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
custom_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
template_id
within your Create message API requests with custom_data
property.Abandoned cart push template example
cart
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.default
image as well. Example:https://
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://"}}
template_id
within your Create message API requests with custom_data
property.support@onesignal.com
Please include: