FindPrompts
n8nE-CommerceIntermediate4 steps

Abandoned Cart Recovery

When Shopify reports an abandoned checkout, this workflow waits an hour, generates a personalized recovery email with GPT referencing the cart items, and sends it. Win back revenue on autopilot.

ShopifyOpenAIGmail

How it works

  1. 1Trigger: Shopify webhook on checkout abandoned
  2. 2Wait one hour to give the shopper time
  3. 3Generate a personalized recovery email with GPT
  4. 4Send the recovery email via Gmail

Setup

  • Connect Shopify, OpenAI and Gmail credentials.
  • checkouts/create approximates abandonment; refine with order-check logic.
  • Add an If node to skip if the order later completes.
  • The Wait node needs persistent executions enabled.

Workflow JSON

{
  "name": "Abandoned Cart Recovery",
  "nodes": [
    {
      "id": "ac01aa",
      "name": "Cart Abandoned",
      "type": "n8n-nodes-base.shopifyTrigger",
      "typeVersion": 1,
      "position": [
        200,
        300
      ],
      "parameters": {
        "topic": "checkouts/create"
      }
    },
    {
      "id": "ac02bb",
      "name": "Wait 1 Hour",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        420,
        300
      ],
      "parameters": {
        "amount": 1,
        "unit": "hours"
      }
    },
    {
      "id": "ac03cc",
      "name": "Write Recovery Email",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        640,
        300
      ],
      "parameters": {
        "modelId": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "Write a warm, short cart-recovery email with a gentle nudge and the items listed."
            },
            {
              "role": "user",
              "content": "Customer: {{ $('Cart Abandoned').item.json.email }}\nItems: {{ JSON.stringify($('Cart Abandoned').item.json.line_items) }}"
            }
          ]
        }
      }
    },
    {
      "id": "ac04dd",
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        860,
        300
      ],
      "parameters": {
        "resource": "message",
        "operation": "send",
        "sendTo": "={{ $('Cart Abandoned').item.json.email }}",
        "subject": "You left something behind",
        "message": "={{ $json.message.content }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Cart Abandoned": {
      "main": [
        [
          {
            "node": "Wait 1 Hour",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 1 Hour": {
      "main": [
        [
          {
            "node": "Write Recovery Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Recovery Email": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "meta": {}
}

Command Palette

Search for a command to run...