{
  "name": "Automate order fulfillment and inventory sync from WooCommerce to Google Sheets and Slack",
  "tags": [],
  "nodes": [
    {
      "id": "4765c8d6-5b8e-4165-99aa-a7d4f516e8bf",
      "name": "Main Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -16
      ],
      "parameters": {
        "width": 450,
        "height": 402,
        "content": "## How it works\nThis pipeline automatically processes orders from WooCommerce. It automates inventory checks, shipping cost calculations, customer/team notifications based on order status, and logs all data to Google Sheets.\n\n## Setup steps\n1. **WooCommerce**: Configure the Webhook URL in your WooCommerce settings and verify the API connection.\n2. **Inventory**: In the \"Check Inventory\" node, configure the connection to your own inventory DB/system (currently using simulated data).\n3. **Credentials**: Set up credentials for the Gmail, Slack, and Google Sheets nodes.\n4. **Sheet Prep**: Specify the Spreadsheet ID and Sheet Name where order data should be logged."
      },
      "typeVersion": 1
    },
    {
      "id": "dee4761e-724e-4131-9c4b-84cfdcea4e47",
      "name": "Group Sticky 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        144
      ],
      "parameters": {
        "color": 7,
        "width": 550,
        "height": 362,
        "content": "### 1. Order Intake\nCapture order data via Webhook or scheduled sync. Converts raw data into a clean JSON format for processing."
      },
      "typeVersion": 1
    },
    {
      "id": "a3972b7d-1621-4c1a-ac70-223cceef3f10",
      "name": "Group Sticky 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 580,
        "height": 284,
        "content": "### 2. Inventory Check\nSplits the order into individual items to check stock levels. Determines if the entire order can be fulfilled immediately."
      },
      "typeVersion": 1
    },
    {
      "id": "b582d7fe-f953-47b8-b739-012995e239b4",
      "name": "Group Sticky 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 284,
        "content": "### 3. Processing Logic\nCalculates shipping costs and determines fulfillment priority. Branches the workflow based on stock availability."
      },
      "typeVersion": 1
    },
    {
      "id": "10df4ac9-7991-42c9-bb7b-1611d6920107",
      "name": "Group Sticky 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 410,
        "height": 542,
        "content": "### 4. Automated Notifications\nSends confirmation or backorder emails to the customer and triggers Slack alerts for the fulfillment/inventory teams."
      },
      "typeVersion": 1
    },
    {
      "id": "0a424399-87ee-466f-a0ef-6f5a50124d48",
      "name": "Group Sticky 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 550,
        "height": 316,
        "content": "### 5. Logging & Response\nLogs the final order status to Google Sheets and returns a success response to the triggering Webhook."
      },
      "typeVersion": 1
    },
    {
      "id": "51516c22-d868-40c1-9aaa-10e5f9e25f81",
      "name": "WooCommerce Order Webhook1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        608,
        256
      ],
      "parameters": {
        "path": "woo-new-order",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "99777061-e93b-47e9-a3c4-2d85c389d226",
      "name": "Scheduled Order Sync1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        608,
        400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a256ab93-a007-4f45-a6a3-4a3e90c2aeda",
      "name": "Merge Triggers1",
      "type": "n8n-nodes-base.merge",
      "position": [
        832,
        336
      ],
      "parameters": {
        "mode": "chooseBranch"
      },
      "typeVersion": 3
    },
    {
      "id": "0fc30c6c-4af0-4608-ae3c-c5adb467d8c4",
      "name": "Extract Order Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        336
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst order = input.body || input;\nconst items = (order.line_items || []).map(item => ({\n  productId: item.product_id,\n  name: item.name,\n  sku: item.sku || 'N/A',\n  quantity: item.quantity,\n  price: parseFloat(item.price) || 0,\n  total: parseFloat(item.total) || 0\n}));\nconst shipping = order.shipping || {};\nconst billing = order.billing || {};\nreturn [{ json: { orderId: order.id, orderNumber: order.number || 'ORD-' + Date.now(), items, customer: { email: billing.email, firstName: billing.first_name }, shipping: { city: shipping.city, country: shipping.country || 'US' }, total: parseFloat(order.total) || 0 } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "05aa69ac-cbc3-4504-8753-bee619084b13",
      "name": "Split Order Items1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1200,
        336
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "aaa8920a-cf46-44c7-a545-ee3d5f79cb2d",
      "name": "Check Inventory1",
      "type": "n8n-nodes-base.code",
      "position": [
        1408,
        336
      ],
      "parameters": {
        "jsCode": "const item = $input.first().json;\nreturn [{ json: { ...item, isInStock: true, stockStatus: 'available' } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "67f2717d-136f-4889-8d76-f771696ff368",
      "name": "Aggregate Inventory Results1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1600,
        336
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "9614eba8-ad46-46b8-be6b-cbd8e9435015",
      "name": "Process Order Logic1",
      "type": "n8n-nodes-base.code",
      "position": [
        1824,
        336
      ],
      "parameters": {
        "jsCode": "const items = $input.first().json.data;\nconst orderData = $('Extract Order Data1').first().json;\nreturn [{ json: { ...orderData, inventory: { allInStock: true }, fulfillment: { status: 'ready', priority: 'normal' }, shipping: { selectedRate: { carrier: 'UPS', method: 'Ground', days: '3-5' } } } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "a9d04053-2fb2-4bc4-929c-429590de72e3",
      "name": "Check Fulfillment Status1",
      "type": "n8n-nodes-base.if",
      "position": [
        2032,
        336
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.inventory.allInStock }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f65094e2-439b-44fb-bb17-c4f6eaca154a",
      "name": "Send Customer Confirmation1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2256,
        240
      ],
      "parameters": {
        "sendTo": "={{ $json.customer.email }}",
        "message": "Thank you!",
        "options": {},
        "subject": "Order Confirmed"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f6cc697e-c350-4ddf-8c3d-7d2a423d4eaf",
      "name": "Send Backorder Notice1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2256,
        432
      ],
      "parameters": {
        "sendTo": "={{ $json.customer.email }}",
        "message": "Some items are on backorder.",
        "options": {},
        "subject": "Backorder notice"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c771b441-77a3-412f-bb8d-2ff01e5684f7",
      "name": "Notify Fulfillment Team1",
      "type": "n8n-nodes-base.slack",
      "position": [
        2464,
        160
      ],
      "parameters": {
        "text": "New Order!",
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "e1ec91a0-865d-4d2e-982d-c5f3d5664c3a",
      "name": "Backorder Alert1",
      "type": "n8n-nodes-base.slack",
      "position": [
        2464,
        352
      ],
      "parameters": {
        "text": "Backorder alert!",
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "12045055-0796-4409-bb5c-0cc58abcc399",
      "name": "Merge Processing Paths1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2688,
        336
      ],
      "parameters": {
        "mode": "chooseBranch"
      },
      "typeVersion": 3
    },
    {
      "id": "aab953bc-eed7-4cc5-b70c-7297b0bf077d",
      "name": "Log Order to Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2864,
        336
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "1d92aff6-a4ca-440c-a431-865b12fef15c",
      "name": "Respond to Webhook1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3056,
        336
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ {success: true} }}"
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "2bf132ad-d5ec-497b-b528-744299beaa88",
  "connections": {
    "Merge Triggers1": {
      "main": [
        [
          {
            "node": "Extract Order Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Backorder Alert1": {
      "main": [
        [
          {
            "node": "Merge Processing Paths1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Check Inventory1": {
      "main": [
        [
          {
            "node": "Aggregate Inventory Results1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Order Items1": {
      "main": [
        [
          {
            "node": "Check Inventory1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Order Data1": {
      "main": [
        [
          {
            "node": "Split Order Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Order to Sheets1": {
      "main": [
        [
          {
            "node": "Respond to Webhook1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Order Logic1": {
      "main": [
        [
          {
            "node": "Check Fulfillment Status1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scheduled Order Sync1": {
      "main": [
        [
          {
            "node": "Merge Triggers1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send Backorder Notice1": {
      "main": [
        [
          {
            "node": "Merge Processing Paths1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Processing Paths1": {
      "main": [
        [
          {
            "node": "Log Order to Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Fulfillment Team1": {
      "main": [
        [
          {
            "node": "Merge Processing Paths1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Fulfillment Status1": {
      "main": [
        [
          {
            "node": "Send Customer Confirmation1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Notify Fulfillment Team1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Backorder Notice1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Backorder Alert1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WooCommerce Order Webhook1": {
      "main": [
        [
          {
            "node": "Merge Triggers1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Customer Confirmation1": {
      "main": [
        [
          {
            "node": "Merge Processing Paths1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Inventory Results1": {
      "main": [
        [
          {
            "node": "Process Order Logic1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}