In this article, we will show you how to create a dynamic abandoned cart email template in HubSpot using personalization tokens created by the Magento HubSpot integration.
1. Create a Custom Module in HubSpot
2. Click Create New File
3. Select Module
4. Configure new Module
5. Populate the new module with the following code (this code contains the clickable names and images of the abandoned cart items):
{% if contact.eyemagine_abandoned_item_product_name_1 is defined and contact.eyemagine_abandoned_item_product_name_1 ne '-' %} <p><a href="{{ contact.eyemagine_abandoned_item_product_url_1 }}"><img src="{{ contact.eyemagine_abandoned_item_product_img_1 }}" alt="{{ contact.eyemagine_abandoned_item_product_name_1 }}" /> </a></p> <p><a href="{{ contact.eyemagine_abandoned_item_product_url_1 }}">{{ contact.eyemagine_abandoned_item_product_name_1 }}</a></p> {% endif %} {% if contact.eyemagine_abandoned_item_product_name_2 is defined and contact.eyemagine_abandoned_item_product_name_2 ne '-' %} <p><a href="{{ contact.eyemagine_abandoned_item_product_url_2 }}"><img src="{{ contact.eyemagine_abandoned_item_product_img_2 }}" alt="{{ contact.eyemagine_abandoned_item_product_name_2 }}" /> </a></p> <p><a href="{{ contact.eyemagine_abandoned_item_product_url_2 }}">{{ contact.eyemagine_abandoned_item_product_name_2 }}</a></p> {% endif %} {% if contact.eyemagine_abandoned_item_product_name_3 is defined and contact.eyemagine_abandoned_item_product_name_3 ne '-' %} <p><a href="{{ contact.eyemagine_abandoned_item_product_url_3 }}"><img src="{{ contact.eyemagine_abandoned_item_product_img_3 }}" alt="{{ contact.eyemagine_abandoned_item_product_name_3 }}" /> </a></p> <p><a href="{{ contact.eyemagine_abandoned_item_product_url_3 }}">{{ contact.eyemagine_abandoned_item_product_name_3 }}</a></p> {% endif %}
5a. Select Enable module for programmable email
6. Save Module
7. Create a new Email
8. Select your template or create a new one and insert the Module we created in the steps above
9. Drag the Module into your email template
SUMMARY: Test the email template using a contact record with multiple items in the abandoned cart.