WooCommerce order confirmation on WhatsApp

Send every new WooCommerce customer a WhatsApp message with their order number and total.

Easy Saves ~4 hours/month E-commerceBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: WooCommerce — order created
  1. Receive the new order from WooCommerce.
  2. Clean the billing phone into international format.
  3. Send an approved WhatsApp template with the name, order number and total.

Diagram

WNew orderWooCommerce Trigger{ }Clean phoneCodeWSend confirmationWhatsApp Business Cloud
Trigger App Code

Code

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

Clean phone · Code node
// Mode: Run Once for Each Item
// Turns the billing phone into international format for WhatsApp (digits only).
// Set your own country code: 20 Egypt, 966 Saudi Arabia, 971 UAE, 965 Kuwait…
const COUNTRY_CODE = "20";
const b = $json.billing || {};
let phone = String(b.phone || "").replace(/[^0-9]/g, "").replace(/^00/, "");
if (phone.startsWith("0")) phone = COUNTRY_CODE + phone.slice(1);

return {
  json: {
    phone,
    name: b.first_name || "",
    order: $json.number,
    total: `${$json.total} ${$json.currency}`,
  },
};

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 (119 lines)
{
  "name": "WooCommerce order confirmation on WhatsApp (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## WooCommerce order confirmation on WhatsApp\nSend every new WooCommerce customer a WhatsApp message with their order number and total.\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": "3f369b32-6a79-4ecd-a51a-12b895911d47",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "event": "order.created"
      },
      "id": "3f369b32-6a79-4ecd-a51a-12b895911d47",
      "name": "New order",
      "type": "n8n-nodes-base.wooCommerceTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "webhookId": "3f369b32-6a79-4ecd-a51a-12b895911d47"
    },
    {
      "parameters": {
        "jsCode": "// Mode: Run Once for Each Item\n// Turns the billing phone into international format for WhatsApp (digits only).\n// Set your own country code: 20 Egypt, 966 Saudi Arabia, 971 UAE, 965 Kuwait…\nconst COUNTRY_CODE = \"20\";\nconst b = $json.billing || {};\nlet phone = String(b.phone || \"\").replace(/[^0-9]/g, \"\").replace(/^00/, \"\");\nif (phone.startsWith(\"0\")) phone = COUNTRY_CODE + phone.slice(1);\n\nreturn {\n  json: {\n    phone,\n    name: b.first_name || \"\",\n    order: $json.number,\n    total: `${$json.total} ${$json.currency}`,\n  },\n};",
        "mode": "runOnceForEachItem"
      },
      "id": "3f369b32-6a79-4ecd-a51a-12b895911d47",
      "name": "Clean phone",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "operation": "sendTemplate",
        "phoneNumberId": "YOUR_PHONE_NUMBER_ID",
        "recipientPhoneNumber": "={{ $json.phone }}",
        "template": "YOUR_ORDER_CONFIRMATION_TEMPLATE|ar",
        "components": {
          "component": [
            {
              "type": "body",
              "bodyParameters": {
                "parameter": [
                  {
                    "type": "text",
                    "text": "={{ $json.name || 'عميلنا العزيز' }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.order }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.total }}"
                  }
                ]
              }
            }
          ]
        }
      },
      "id": "3f369b32-6a79-4ecd-a51a-12b895911d47",
      "name": "Send confirmation",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1,
      "position": [
        600,
        0
      ]
    }
  ],
  "connections": {
    "New order": {
      "main": [
        [
          {
            "node": "Clean phone",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean phone": {
      "main": [
        [
          {
            "node": "Send confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

Open in the playground to edit →

Tips

  • Make the phone field required at checkout, and set your country code in the Code step.
  • Add a second template for "order shipped" using the order.updated event.

Related flows