AutomationFlowsE-commerce › Auto-collect Woocommerce Orders to Discord & Google Sheets

Auto-collect Woocommerce Orders to Discord & Google Sheets

ByKhairul Muhtadin @khmuhtadin on n8n.io

This n8n workflow automates WooCommerce order processing by capturing order updates via webhook and converting them into Discord notifications and Google Sheets entries.

Webhook trigger★★★★☆ complexity8 nodesDiscordGoogle Sheets
E-commerce Trigger: Webhook Nodes: 8 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #8518 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "zonJvk4B9Hisfacz",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automate Collect and Notify Wocommerce Order",
  "tags": [],
  "nodes": [
    {
      "id": "6528e446-5ea9-497c-995c-5e3959f1ade2",
      "name": "Order webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        192,
        336
      ],
      "parameters": {
        "path": "YOUR_WEBHOOK_PATH_HERE",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "60f0a5f8-348f-40af-89dd-ffea9e0e54f2",
      "name": "Parse Order Data",
      "type": "n8n-nodes-base.code",
      "position": [
        416,
        336
      ],
      "parameters": {
        "jsCode": "// N8N Node Code untuk parsing WooCommerce Order ke Discord\\n\\n// Debug: Cek struktur data yang masuk\\nconsole.log('Full $json:', JSON.stringify($json, null, 2));\\n\\n// Coba berbagai kemungkinan struktur data\\nlet orderData;\\n\\nif ($json && $json.body) {\\n  // Jika data langsung di $json.body\\n  orderData = $json.body;\\n} else if ($json && Array.isArray($json) && $json[0] && $json[0].body) {\\n  // Jika data di $json[0].body\\n  orderData = $json[0].body;\\n} else if ($json && Array.isArray($json) && $json[0]) {\\n  // Jika data langsung di $json[0]\\n  orderData = $json[0];\\n} else if ($json) {\\n  // Jika data langsung di $json\\n  orderData = $json;\\n} else {\\n  throw new Error('Data webhook tidak ditemukan. Struktur data: ' + JSON.stringify($json));\\n}\\n\\n// Validasi apakah orderData memiliki field yang dibutuhkan\\nif (!orderData || !orderData.id) {\\n  throw new Error('Data pesanan tidak valid. OrderData: ' + JSON.stringify(orderData));\\n}\\n\\n// Parse informasi pesanan utama\\nconst orderInfo = {\\n  id: orderData.id,\\n  status: orderData.status,\\n  total: orderData.total,\\n  currency: orderData.currency,\\n  currency_symbol: orderData.currency_symbol,\\n  date_created: orderData.date_created,\\n  payment_method: orderData.payment_method_title,\\n  shipping_total: orderData.shipping_total\\n};\\n\\n// Parse informasi customer\\nconst customerInfo = {\\n  name: `${orderData.billing.first_name} ${orderData.billing.last_name}`,\\n  email: orderData.billing.email,\\n  phone: orderData.billing.phone,\\n  address: `${orderData.billing.address_1}${orderData.billing.address_2 ? ', ' + orderData.billing.address_2 : ''}, ${orderData.billing.city}, ${orderData.billing.state} ${orderData.billing.postcode}`,\\n  country: orderData.billing.country\\n};\\n\\n// Parse item-item yang dibeli (dinamis)\\nconst items = orderData.line_items.map(item => ({\\n  name: item.name,\\n  sku: item.sku,\\n  quantity: item.quantity,\\n  price: item.price,\\n  subtotal: item.subtotal,\\n  product_id: item.product_id,\\n  image_url: item.image?.src || null\\n}));\\n\\n// Parse informasi pengiriman\\nconst shippingInfo = orderData.shipping_lines.length > 0 ? {\\n  method: orderData.shipping_lines[0].method_title,\\n  cost: orderData.shipping_lines[0].total\\n} : null;\\n\\n// Format currency untuk display\\nconst formatCurrency = (amount) => {\\n  return new Intl.NumberFormat('id-ID', {\\n    style: 'currency',\\n    currency: orderData.currency,\\n    minimumFractionDigits: 0\\n  }).format(amount);\\n};\\n\\n// Buat embed untuk Discord\\nconst discordEmbed = {\\n  title: `\ud83d\uded2 Pesanan Baru #${orderInfo.id}`,\\n  color: orderInfo.status === 'pending' ? 16776960 : orderInfo.status === 'processing' ? 255 : orderInfo.status === 'completed' ? 65280 : 16711680,\\n  timestamp: new Date(orderInfo.date_created).toISOString(),\\n  fields: [\\n    { name: \\\"\ud83d\udcca Status Pesanan\\\", value: orderInfo.status.toUpperCase(), inline: true },\\n    { name: \\\"\ud83d\udcb0 Total Pembayaran\\\", value: formatCurrency(orderInfo.total), inline: true },\\n    { name: \\\"\ud83d\udcb3 Metode Pembayaran\\\", value: orderInfo.payment_method, inline: true },\\n    { name: \\\"\ud83d\udc64 Customer\\\", value: `**Nama:** ${customerInfo.name}\\\\n**Email:** ${customerInfo.email}\\\\n**Telepon:** ${customerInfo.phone}`, inline: false },\\n    { name: \\\"\ud83d\udccd Alamat Pengiriman\\\", value: customerInfo.address, inline: false }\\n  ]\\n};\\n\\n// Tambahkan field untuk setiap item yang dibeli\\nitems.forEach((item, index) => {\\n  discordEmbed.fields.push({\\n    name: `\ud83d\udecd\ufe0f Item ${index + 1}`,\\n    value: `**${item.name}**\\\\nSKU: ${item.sku}\\\\nQty: ${item.quantity}x\\\\nHarga: ${formatCurrency(item.price)}\\\\nSubtotal: ${formatCurrency(item.subtotal)}`,\\n    inline: true\\n  });\\n});\\n\\n// Tambahkan info pengiriman jika ada\\nif (shippingInfo) {\\n  discordEmbed.fields.push({\\n    name: \\\"\ud83d\ude9a Pengiriman\\\",\\n    value: `${shippingInfo.method}\\\\nBiaya: ${formatCurrency(shippingInfo.cost)}`,\\n    inline: true\\n  });\\n}\\n\\n// Tambahkan thumbnail dari produk pertama jika ada gambar\\nif (items.length > 0 && items[0].image_url) {\\n  discordEmbed.thumbnail = { url: items[0].image_url };\\n}\\n\\n// Footer dengan informasi tambahan\\ndiscordEmbed.footer = {\\n  text: `Order ID: ${orderInfo.id} | Taffware Store`,\\n  icon_url: \\\"https://taffware.com/wp-content/uploads/2024/03/cropped-logo-taffware-32x32.png\\\"\\n};\\n\\n// Return data untuk Discord Bot\\nreturn [{\\n  json: {\\n    title: discordEmbed.title,\\n    color: discordEmbed.color,\\n    description: `**Customer:** ${customerInfo.name}\\\\n**Email:** ${customerInfo.email}\\\\n**Total:** ${formatCurrency(orderInfo.total)}`,\\n    fields: discordEmbed.fields.slice(0, 10),\\n    timestamp: discordEmbed.timestamp,\\n    footer: discordEmbed.footer,\\n    thumbnail: discordEmbed.thumbnail\\n  }\\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "84c99979-29e2-4408-9887-3ffbe4f6d3f0",
      "name": "Check If Processing",
      "type": "n8n-nodes-base.if",
      "position": [
        640,
        336
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c793e31e-9c60-4cbf-9182-548632f7158c",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.fields[0].value }}",
              "rightValue": "PROCESSING"
            },
            {
              "id": "df59eb44-df34-4621-ae02-658890cb828e",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.footer.text }}",
              "rightValue": "your-store"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "20bcf3cc-fa0f-4f5b-ab82-b9752e60dcde",
      "name": "Notify Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        864,
        432
      ],
      "parameters": {
        "embeds": {
          "values": [
            {
              "color": "={{ \n  $json.status === \"pending\" ? 16776960 : \n  ($json.status === \"processing\" ? 255 : \n  ($json.status === \"CANCELED\" ? 8421504 : 65280)) \n}}",
              "title": "={{ $json.title }}",
              "description": "={{ $json.fields[0].name }}: {{ $json.fields[0].value }}\n\n{{ $json.fields[3].value }}\n\n{{ $json.fields[4].name }}: {{ $json.fields[4].value }}\n\nItem:{{ $json.fields[5].value }}\n\n{{ $json.fields[6].name }}: {{ $json.fields[6].value }}\n\n{{ $json.fields[1].name }}: {{ $json.fields[1].value }}\n{{ $json.fields[2].name }}: {{ $json.fields[2].value }}\n\n"
            }
          ]
        },
        "content": "=",
        "guildId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_DISCORD_SERVER_ID"
        },
        "options": {},
        "resource": "message",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_DISCORD_CHANNEL_ID",
          "cachedResultUrl": "https://discord.com/channels/YOUR_SERVER_ID/YOUR_CHANNEL_ID",
          "cachedResultName": "order-notifications"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b0759142-802d-4879-935b-dd26805bbe38",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1088,
        432
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "cca69e7d-9f48-4b99-beae-109335bc6e59",
      "name": "Append Order Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        864,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "Bulan": "={{ new Date($json.timestamp).toLocaleDateString('en-US') }}",
            "Nomor Pesanan Web": "={{ $json.title.match(/#(\\d+)/)[1] }}"
          },
          "schema": [
            {
              "id": "Bulan",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Bulan",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Brand",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Brand",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Nomor Pesanan Web",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nomor Pesanan Web",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "No Pesanan Jakmall",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "No Pesanan Jakmall",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Ekspedisi",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Ekspedisi",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "No Resi",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "No Resi",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "YOUR_GOOGLE_SHEETS_URL#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_GOOGLE_SHEETS_URL"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "d2ee2854-eba6-411a-a1af-e21ec8db4275",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        592
      ],
      "parameters": {
        "width": 1088,
        "height": 208,
        "content": "## Collect WooCommerce Order\n\n- **Set up your webhook URL in WooCommerce** to send order updates to n8n.\n- **All order statuses (\"PROCESSING\", \"PENDING\", \"CANCEL\")** are sent as notifications to Discord.\n- **Only \"PROCESSING\" orders** (already paid) are also appended to Google Sheets for tracking.\n- **\"PENDING\" or \"CANCEL\" orders** are not logged in the sheet, only notified on Discord.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6d007cc8-9d90-4715-a4bb-25123629a2ef",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        208
      ],
      "parameters": {
        "width": 496,
        "height": 592,
        "content": "## Getting Credentials\n\n### 1. Discord Bot Token\n- Visit the [Discord Developer Portal](https://discord.com/developers/applications).\n- Create a new application and add a bot.\n- Copy your bot token and enter it in n8n's Discord node credentials.\n\n### 2. Google Sheets OAuth2\n- Go to the [Google Cloud Console](https://console.cloud.google.com/).\n- Create a new project and enable the Google Sheets API.\n- Set up the OAuth consent screen and create OAuth credentials.\n- Download your credentials and add them to n8n's Google Sheets node.\n- Authenticate with your Google account when prompted.\n\n### 3. WooCommerce Webhook\n- In WooCommerce admin, go to **Settings > Advanced > Webhooks**.\n- Add a new webhook and set the delivery URL to your n8n webhook endpoint.\n- Select the event type (e.g., Order Updated) and activate the webhook.\n\n**Note:** Test all credentials in n8n to ensure proper connection before using the workflow."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aa500a95-0e12-40c5-b34f-f4467dc0c8dd",
  "connections": {
    "Order webhook": {
      "main": [
        [
          {
            "node": "Parse Order Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Discord": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Order Data": {
      "main": [
        [
          {
            "node": "Check If Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Processing": {
      "main": [
        [
          {
            "node": "Notify Discord",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append Order Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow automates WooCommerce order processing by capturing order updates via webhook and converting them into Discord notifications and Google Sheets entries.

Source: https://n8n.io/workflows/8518/ — original creator credit. Request a take-down →

More E-commerce workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

E-commerce

This workflow provides a robust, end-to-end automated pipeline for managing e-commerce orders. It bridges the gap between your storefront and your fulfillment team by handling inventory validation, mu

Gmail, Slack, Google Sheets
E-commerce

This n8n workflow helps Shopify store owners and teams automatically confirm orders via WhatsApp. It checks if the customer's number is valid using Rapiwa API, sends a personalized message, and logs e

HTTP Request, Google Sheets
E-commerce

This workflow is for online store owners, support teams, and marketing staff who want to automatically verify WhatsApp numbers and send order invoice links or personalized order updates to customers.

Google Sheets, N8N Nodes Rapiwa
E-commerce

This workflow is designed for e-commerce store owners, operations managers, and developers who use Shopify as their e-commerce platform and want an automated way to track and analyze their order data.

Google Sheets, Telegram
E-commerce

This workflow tracks new Shopify orders in real-time and logs them to a Google Sheet, while also sending a structured order summary to a Discord channel. Perfect for keeping your team and records upda

Shopify Trigger, Google Sheets, Discord