Abandoned cart reminders on WhatsApp

Customers who leave checkout get a friendly WhatsApp reminder with a link back to their cart.

Medium Saves ~6 hours/month E-commerceBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Schedule — every hour
  1. Every hour, get checkouts abandoned 1–2 hours ago from Shopify.
  2. Keep the ones with a phone number that weren't completed.
  3. Send each customer an approved WhatsApp template with their total and a link back to the cart.

Diagram

Every hourSchedule TriggerGet abandoned check…HTTP Request{ }Carts with a phoneCodeWSend cart reminderWhatsApp Business Cloud
Trigger App Code

Code

JavaScript used in the Code step — already included in the template below.

Carts with a phone · Code node
// Keeps abandoned checkouts from the last hour or two that have a phone number
// and were not completed, ready for a WhatsApp reminder.
const checkouts = $input.first().json.checkouts || [];

return checkouts
  .filter((c) => !c.completed_at)
  .map((c) => ({
    phone: String(c.phone || c.shipping_address?.phone || c.billing_address?.phone || "").replace(/[^0-9]/g, ""),
    name: c.shipping_address?.first_name || c.customer?.first_name || "",
    total: `${c.total_price} ${c.currency}`,
    url: c.abandoned_checkout_url,
  }))
  .filter((c) => c.phone.length >= 10)
  .map((c) => ({ json: c }));

Build it

Pick your tool — same automation, step by step.

Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.

Workflow JSON
Show code (151 lines)
{
  "name": "Abandoned cart reminders on WhatsApp (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## Abandoned cart reminders on WhatsApp\nCustomers who leave checkout get a friendly WhatsApp reminder with a link back to their cart.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
        "height": 260,
        "width": 340
      },
      "id": "458210f1-f980-4989-a1ec-07858e8eaece",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 1
            }
          ]
        }
      },
      "id": "458210f1-f980-4989-a1ec-07858e8eaece",
      "name": "Every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "url": "=https://YOUR_STORE.myshopify.com/admin/api/2024-10/checkouts.json?created_at_min={{ $now.minus({ hours: 2 }).toISO() }}&created_at_max={{ $now.minus({ hours: 1 }).toISO() }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "shopifyAccessTokenApi",
        "options": {}
      },
      "id": "458210f1-f980-4989-a1ec-07858e8eaece",
      "name": "Get abandoned checkouts",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "// Keeps abandoned checkouts from the last hour or two that have a phone number\n// and were not completed, ready for a WhatsApp reminder.\nconst checkouts = $input.first().json.checkouts || [];\n\nreturn checkouts\n  .filter((c) => !c.completed_at)\n  .map((c) => ({\n    phone: String(c.phone || c.shipping_address?.phone || c.billing_address?.phone || \"\").replace(/[^0-9]/g, \"\"),\n    name: c.shipping_address?.first_name || c.customer?.first_name || \"\",\n    total: `${c.total_price} ${c.currency}`,\n    url: c.abandoned_checkout_url,\n  }))\n  .filter((c) => c.phone.length >= 10)\n  .map((c) => ({ json: c }));"
      },
      "id": "458210f1-f980-4989-a1ec-07858e8eaece",
      "name": "Carts with a phone",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "operation": "sendTemplate",
        "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
        "recipientPhoneNumber": "={{ $json.phone }}",
        "template": "YOUR_CART_REMINDER_TEMPLATE|ar",
        "components": {
          "component": [
            {
              "type": "body",
              "bodyParameters": {
                "parameter": [
                  {
                    "type": "text",
                    "text": "={{ $json.name || 'عميلنا العزيز' }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.total }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.url }}"
                  }
                ]
              }
            }
          ]
        }
      },
      "id": "458210f1-f980-4989-a1ec-07858e8eaece",
      "name": "Send cart reminder",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        900,
        0
      ]
    }
  ],
  "connections": {
    "Every hour": {
      "main": [
        [
          {
            "node": "Get abandoned checkouts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get abandoned checkouts": {
      "main": [
        [
          {
            "node": "Carts with a phone",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Carts with a phone": {
      "main": [
        [
          {
            "node": "Send cart reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

Open in the playground to edit →

Tips

  • Only message customers who agreed to WhatsApp messages at checkout.
  • A small discount code in the template often doubles recoveries.

Related flows