line

Abandoned Cart Workflow

The Abandoned Cart workflow is an easy way to improve your conversion rate in E-commerce. The user receives a notification to incite him to complete the check out. After one week, the content of the cart is removed.

Visual of Workflow

A visual representation of the workflow logic.
line

Workflow Steps

  • Remove cart's content
  • Send an email to the user for his abandoned cart
  • If after more than one week, the user didn't come back to the platform, then the workflow is finished
  • If they do come back, the initial content is added back to the cart, allowing him to finish the check out

Workflow Code

This workflow is the code that orchestrates the tasks through the Zenaton workflow engine and are then executed on your servers. Then, the customer proceeds to payment.

const { workflow, duration } = require("zenaton");

module.exports = workflow("AbandonedCart", function*(cart) {
    const sendgrid = this.connector('sendgrid', 'your-connector-id');

    yield this.run.task("RemoveCart", cart.email)

    yield sendgrid.post('/mail/send', {body: {"template_id": "abandoned_cart", ...}})

    const cart_resumed = yield this.wait.event("CartResumed").for(duration.weeks(1));

    if (cart_resumed) {
      yield this.run.task("AddInitialCart", cart)
    } 
});

Workflow Executions

View the real-time tasks executions of this workflow.
line