Create a Deal Based abandoned cart email + workflow + module

Using custom modules is a great way to leverage the data that comes into your HubSpot through our Unific Sync product. Show the right products in each email to your customers.

Abandoned carts are an e-commerce merchants daily challenge. HubSpot helps you face it through automating the emails a client would receive once they abandon a cart, but even a tool as strong as HubSpot, can be improved.


The Unific Data Sync Product gets your abandoned cart data into HubSpot

The first step to doing so, is our Unific Sync product, which includes over 140 properties synced to both contact and deal record, over 10% of which are details of a customers’ abandoned carts. The most important properties to know:

We save line items in the deal record and up to 3 product URL’s in the contacts in order to have a way to dynamically show them in each email sent.

In this article we will walk through creating the workflow and the custom modules needed for it to work. 


*Default HubSpot modules will not work for any third-party app.


Choosing your type of workflow

The first step in creating a workflow is going to your Automation tab on the top toolbar in your HubSpot portal. Depending on your HubSpot plan some features may be limited.

There are two types of workflows that you can use for abandoned carts, each with its own advantages and disadvantages.

Contact based workflow

To create a contact-based workflow and email, please refer to this article.


  • Prevents double enrollment for contacts with more than one deal that is abandoned
  • Allows you to set up and track goals, measuring conversions and success inside each workflow
  • Used and relies on tools that are not beta products


  • Is triggered after deal creation, when a contact property is updated in the backend
  • Revenue cannot be specifically attributed to each deal
  • Only allows up to 3 abandoned products to show in each email sent

Deal based workflow


  • Allows concurrent enrollment of more than one abandoned cart deal
  • Is triggered by deal creation, and deal stage ABANDONED being reached.
  • Revenue is attributed to each deal through attribution reporting outside the workflow (reports must be created manually)


  • Does not allow for goals to be set up and measured inside the workflow, only un-enrollment triggers
  • Display of line items when there are variants and currencies can be limited
  • Depends on a beta feature

How to create a deal-based email + workflow.

In order to have emails that show the desired products, the first step will be to create our custom code module. To do so, please follow these steps:

  1. Open the Marketing tab
  2. Go to Files and Templates
  3. Choose Design tools



4.    On the left-hand panel, chose NEW + FILE




5.   Chose module and give it a name, we recommend:



Screen Shot 2023-01-17 at 8.59.20 PM

6.   Open this module file, and copy and paste its contents into your new module. Make sure to copy everything.

7.  On the right-hand panel chose PUBLISH CHANGES before publishing it make sure the email beta feature on the right panel is turned on. 

Screen Shot 2023-01-17 at 7.55.31 PM

Screen Shot 2023-01-17 at 7.55.48 PM


Creating your email to be sent out

The next step is to create the emails that your clients will receive upon abandoning a cart, this is where we will include the module.

  1. Open the Marketing tab and go to emails


2.   Create a new automated email in the drag-and-drop editor



3.   On the left-hand side panel, choose the MORE option



4.   Find the new module we created and drag it into your email template


*When you drag it will look empty inside the email, that is normal behavior for this type of module. This is why to try it you must to go preview.


5.   There is no way to test this email using the email preview. You must first make the workflow to send out the email and then enroll a deal into the workflow. We've outlined the steps to test below (after you make the workflow).


Best Practice Recommendations

For best practices, we recommend creating 3 to 5 follow-up emails in an abandoned cart sequence over the spread of 10 to 30 days. This can depend on your type of product and the average time to purchase. The goal is to increase the chances of an abandoned cart becoming an order.

Fun fact: we have seen conversions all the way up to the fifth email.


Creating the workflow to automate email send out

Once you have written your emails and included the module in all of them, make sure they are published.

Now it's time to continue with our workflow creation.

  1. Open the Automation tab

  2. Create a new contact workflow from scratch

Screen Shot 2023-01-17 at 9.04.58 PM


3.   Set the basic triggers in the following way:

Screen Shot 2023-01-17 at 9.05.49 PM

The only trigger is the deals being in an Abandoned Cart stage in the Commerce Pipeline. 


4.  Set an if and then statement based on segmenting practices

Screen Shot 2023-01-17 at 9.07.24 PM

If you have segments built through lists, this is where you can define how will you approach each customer differently. Our general recommendation is to provide a discount from the very first email to newer clients but not for recurring ones.


Properties like AVERAGE ORDER AMOUNT and NUMBER OF PURCHASES can help you segment if you don’t already have lists defined.


Our Dynamic Segments product was created to do this for you, creating a property called UNIFIC DYNAMIC SEGMENTS that will read: New Customer, Promising, Big Spender, Loyalist or Champion. This is what you can see in our screenshot.


Screen Shot 2023-01-17 at 8.42.06 PM


*Dynamic segments is a separate product not included in the subscription for the UNIFIC SYNC product. 


5.   Include the emails and set delays between them. This can depend on the type of product, but setting at least 2 to 3 days between them is standard practice.

Screen Shot 2023-01-17 at 8.45.30 PM

6.   Now it’s time to set unenrollment criteria, as deal-based workflows doesn't allow goal setting. On the top, go to settings and choose UNENROLLMENT AND SUPPRESSION. In this instance the unenrollment criteria is the deal being part of any new stage. 

Screen Shot 2023-01-17 at 9.09.03 PM


7.  Turn it on and choose if you want deals from before to be enrolled as well or if you only want it working from the moment you turn it on, into the future.


Screen Shot 2023-01-17 at 8.49.05 PM


How to Test

To test the deal based abandoned cart email for programmable email modules, you must use the "Test" feature in the workflow builder. 

To test the email for programmable email modules, you must use the "Test" feature in the workflow builder. 

Here is how:

  • Click "More" next to the workflow you are working with
  • Click "Test"
  • Next screen allows you to enroll a deal. Make sure the deal you select is for an abandoned cart (checkout) deal synced by Unific


Make sure you enroll a deal that has line items, otherwise it will be empty.



If you don't get an email and the workflow does reach the email action, then make sure your user (the user you are logged in with) is a marketable contact and their newsletter subscriber opt-in status is set to 'yes'.



That is it! You have built a custom module, an email and a workflow to send out abandoned cart reminders. 

Trying to achieve at least 10% in recovery can be great for your revenue, specially considering abandoned carts are usually money left on the table that is nor particularly hard to recover once you have a strategy and the tools to automate, measure and optimize. 


Contact Based Workflow for Abandoned Carts

To create a contact-based workflow and email, please refer to this article.