Describe the problem/error/question
I want to update order status from air table and see the changes in the website i succesed to update order status from website and see the changes in the sheet
What is the error message (if any)?
Please share your workflow
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-176,
-96
],
"id": "",
"name": "Webhook",
"webhookId": ""
},
{
"parameters": {
"jsCode": "const results = [];\n\n// Iterate over all incoming webhooks (items)\nfor (const item of items) {\n const order = item.json.body;\n \n // Safety check: ensure line_items exists\n if (order.line_items && Array.isArray(order.line_items)) {\n \n // 1. Get Main and Sub IDs\n const mainOrderId = order.parent_id !== 0 ? order.parent_id : order.id;\n const subOrderId = order.id;\n\n // 2. Check for 'has_sub_order' flag in meta_data\n const hasSubOrderMeta = order.meta_data.find(meta => meta.key === 'has_sub_order');\n const hasSubOrderValue = hasSubOrderMeta ? hasSubOrderMeta.value : '0';\n\n // 3. Determine \"Is Parent Order\"\n const isParentOrder = (order.parent_id === 0 && hasSubOrderValue === '1') ? \"Yes\" : \"No\";\n\n // Loop through every product (line item) in the order\n for (const lineItem of order.line_items) {\n \n const sheetRow = {\n \"Order ID\": mainOrderId,\n \"Sub Order ID\": String(subOrderId),\n \"Is Parent Order\": isParentOrder,\n \"Date Created\": order.date_created,\n \"Customer Name\": `${order.billing.first_name} ${order.billing.last_name}`,\n \"Customer Phone\": order.billing.phone,\n \"Product Name\": lineItem.name,\n \"Sku\": lineItem.sku || 'N/A',\n \"Quantity\": lineItem.quantity,\n \"Items Total Price\": lineItem.total,\n \"Status\": order.status,\n // --- UPDATED HERE ---\n \"Product Link\": `https://ibtekr.club/?p=${lineItem.product_id}`, \n // --------------------\n \"Vendor\": order.store ? order.store.shop_name : 'Admin',\n \"Brand\": order.store ? order.store.shop_name : 'Admin',\n \"Shipping Total\": order.shipping_total,\n \"Payment Method\": order.payment_method_title\n };\n\n results.push({ json: sheetRow });\n }\n }\n}\n\nreturn results;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
64,
-96
],
"id": "",
"name": "Code in JavaScript"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "",
"leftValue": "={{ $json[\"Is Parent Order\"] }}",
"rightValue": "Yes",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
272,
-96
],
"id": "",
"name": "If main order"
},
{
"parameters": {
"operation": "upsert",
"base": {
"__rl": true,
"value": "appsnA8yszKVlhMCL",
"mode": "list",
"cachedResultName": "ibtekr Orders test",
"cachedResultUrl": "https://airtable.com/"
},
"table": {
"__rl": true,
"value": "tblWzDl1a00U4GJ8n",
"mode": "list",
"cachedResultName": "Orders (Sheet1)",
"cachedResultUrl": "https://airtable.com/"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Order ID": "={{ String($json[\"Order ID\"]) }}",
"Sub Order ID": "={{ String($json[\"Sub Order ID\"]) }}",
"Date Created": "={{ $json[\"Date Created\"] }}",
"Customer Name": "={{ $json[\"Customer Name\"] }}",
"Customer Phone": "={{ $json[\"Customer Phone\"] }}",
"Product Name": "={{ $json[\"Product Name\"] }}",
"SKU": "={{ $json.Sku }}",
"Quantity": "={{ Number($json.Quantity) }}",
"Items Total Price": "={{ Number($json[\"Items Total Price\"]) }}",
"Status": "={{ $json.Status }}",
"Product Link": "={{ $json[\"Product Link\"] }}",
"Vendor": "={{ $json.Vendor }}",
"Shipping": "={{ $json[\"Shipping Total\"] }}",
"Payment Method": "={{ $json[\"Payment Method\"] }}"
},
"matchingColumns": [
"Sub Order ID"
],
"schema": [
{
"id": "id",
"displayName": "id",
"required": false,
"defaultMatch": true,
"display": true,
"type": "string",
"readOnly": true,
"removed": true
},
{
"id": "Order ID",
"displayName": "Order ID",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Sub Order ID",
"displayName": "Sub Order ID",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Website order note",
"displayName": "Website order note",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "options",
"options": [
{
"name": "pending",
"value": "pending"
},
{
"name": "processing",
"value": "processing"
},
{
"name": "Ready for shiping",
"value": "Ready for shiping"
},
{
"name": "in shipping",
"value": "in shipping"
},
{
"name": "completed",
"value": "completed"
},
{
"name": "cancelled",
"value": "cancelled"
},
{
"name": "Refund",
"value": "Refund"
},
{
"name": "Done RTC",
"value": "Done RTC"
},
{
"name": "on-hold",
"value": "on-hold"
},
{
"name": "failed",
"value": "failed"
},
{
"name": "Pending For Sup Orders",
"value": "Pending For Sup Orders"
},
{
"name": "Inprogress",
"value": "Inprogress"
}
],
"readOnly": false,
"removed": false
},
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Vendor notes",
"displayName": "Vendor notes",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Date Created",
"displayName": "Date Created",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "dateTime",
"readOnly": false,
"removed": false
},
{
"id": "Customer Name",
"displayName": "Customer Name",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Customer service note",
"displayName": "Customer service note",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Customer Phone",
"displayName": "Customer Phone",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Quantity",
"displayName": "Quantity",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "number",
"readOnly": false,
"removed": false
},
{
"id": "Product Name",
"displayName": "Product Name",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "SKU",
"displayName": "SKU",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Items Total Price",
"displayName": "Items Total Price",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "number",
"readOnly": false,
"removed": false
},
{
"id": "Product Link",
"displayName": "Product Link",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Shipping",
"displayName": "Shipping",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "number",
"readOnly": false,
"removed": false
},
{
"id": "Payment Method",
"displayName": "Payment Method",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "ibtekr profit",
"displayName": "ibtekr profit",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": true,
"removed": true
},
{
"id": "vendor profit",
"displayName": "vendor profit",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": true,
"removed": true
},
{
"id": "Shipping Records",
"displayName": "Shipping Records",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Pasted field 1",
"displayName": "Pasted field 1",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Pasted field 2",
"displayName": "Pasted field 2",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Pasted field 3",
"displayName": "Pasted field 3",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Pasted field 4",
"displayName": "Pasted field 4",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Pasted field 5",
"displayName": "Pasted field 5",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.airtable",
"typeVersion": 2.1,
"position": [
560,
-80
],
"id": "",
"name": "Create or update a record",
"credentials": {
"airtableTokenApi": {
"id": "VzXZpnBqo89T3sEb",
"name": "Airtable Personal Access Token account"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "If main order",
"type": "main",
"index": 0
}
]
]
},
"If main order": {
"main": [
[],
[
{
"node": "Create or update a record",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {
"Webhook": [
{
"headers": {
"host": "",
"user-agent": "WooCommerce/10.4.3 Hookshot (WordPress/6.9)",
"content-length": "5988",
"accept": "*/*",
"accept-encoding": "gzip, br",
"cdn-loop": "cloudflare; loops=1; subreqs=1",
"cf-connecting-ip": "2a02:4780:8:1805:0:11c1:dc48:1",
"cf-ew-via": "15",
"cf-ipcountry": "NL",
"cf-ray": "9b725ad21083d579-AMS",
"cf-visitor": "{\"scheme\":\"https\"}",
"cf-worker": "n8n.cloud",
"content-type": "application/json",
"x-forwarded-for": "2a02:4780:8:1805:0:11c1:dc48:1, 172.71.95.49",
"x-forwarded-host": ",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-forwarded-server": "traefik-prod-users-gwc-81-6b7d5f4f4f-6g9dm",
"x-is-trusted": "yes",
"x-real-ip": "2a02:4780:8:1805:0:11c1:dc48:1",
"x-wc-webhook-delivery-id": "",
"x-wc-webhook-event": "created",
"x-wc-webhook-id": "64",
"x-wc-webhook-resource": "order",
"x-wc-webhook-signature": "=",
},
"params": {},
"query": {},
"body": {
"id": 133378,
"parent_id": 133377,
"status": "processing",
"currency": "EGP",
"version": "10.4.3",
"prices_include_tax": false,
"date_created": "2026-01-01T15:27:17",
"date_modified": "2026-01-01T15:27:28",
"discount_total": "0",
"discount_tax": "0",
"shipping_total": "0",
"shipping_tax": "0",
"cart_tax": "0",
"total": "11379",
"total_tax": "0",
"customer_id": 2044,
"order_key": "wc_order_WiV83qyjA7Qww",
"billing": {
"first_name": "test",
"last_name": "test",
"company": "",
"address_1": "El-shorouk",
"address_2": "aa",
"city": "",
"state": "EG-17",
"postcode": "",
"country": "EG",
"email": "[email protected]",
"phone": "+201023455435"
},
"shipping": {
"first_name": "test",
"last_name": "test",
"company": "",
"address_1": "El-shorouk",
"address_2": "aa",
"city": "",
"state": "EG-17",
"postcode": "",
"country": "EG",
"phone": ""
},
"payment_method": "cod",
"payment_method_title": "Cash on delivery",
"transaction_id": "",
"customer_ip_address": "156.205.29.205",
"customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
"created_via": "dokan",
"customer_note": "",
"date_completed": null,
"date_paid": null,
"cart_hash": "ba1fa81415becafbac781b054bed63df",
"number": "133378",
"meta_data": [
{
"id": 2785581,
"key": "_dokan_vendor_id",
"value": "3"
},
{
"id": 2785582,
"key": "wpml_language",
"value": "en"
},
{
"id": 2785583,
"key": "bosta_consignee_ranking",
"value": {
"consigneePhone": "+201023455435",
"deliverySuccessRate": 66.6667,
"isNewCustomer": false
}
},
{
"id": 2785584,
"key": "shipping_fee_recipient",
"value": "admin"
},
{
"id": 2785585,
"key": "tax_fee_recipient",
"value": "admin"
},
{
"id": 2785586,
"key": "shipping_tax_fee_recipient",
"value": "admin"
},
{
"id": 2785587,
"key": "shipping_tax_fee_recipient",
"value": "admin"
},
{
"id": 2785647,
"key": "_wpml_word_count",
"value": "5"
}
],
"line_items": [
{
"id": 2744,
"name": "Single Metal Macrame Swing",
"product_id": 96214,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "4004",
"subtotal_tax": "0",
"total": "4004",
"total_tax": "0",
"taxes": [],
"meta_data": [
{
"id": 32634,
"key": "product_extras",
"value": {
"product_id": 96214,
"title": "Single Metal Macrame Swing",
"groups": [],
"purchased_lang": "en",
"aelia_currency": false
},
"display_key": "product_extras",
"display_value": {
"product_id": 96214,
"title": "Single Metal Macrame Swing",
"groups": [],
"purchased_lang": "en",
"aelia_currency": false
}
},
{
"id": 32635,
"key": "_dokan_commission_source",
"value": "global",
"display_key": "dokan_commission_source",
"display_value": "global"
},
{
"id": 32636,
"key": "_dokan_commission_rate",
"value": "40",
"display_key": "_dokan_commission_rate",
"display_value": "40"
},
{
"id": 32637,
"key": "_dokan_commission_type",
"value": "fixed",
"display_key": "_dokan_commission_type",
"display_value": "fixed"
},
{
"id": 32638,
"key": "_dokan_additional_fee",
"value": "0",
"display_key": "_dokan_additional_fee",
"display_value": "0"
},
{
"id": 32639,
"key": "dokan_commission_meta",
"value": [],
"display_key": "dokan_commission_meta",
"display_value": []
},
{
"id": 32640,
"key": "_dokan_parent_order_item_id",
"value": "2740",
"display_key": "dokan_parent_order_item_id",
"display_value": "2740"
}
],
"sku": "IBT120120BHMSM000017",
"global_unique_id": "",
"price": 4004,
"image": {
"id": "96215",
"src": "https://ibtekr.club/wp-content/uploads/2025/03/single-metal-macrame-swing-1-IBT120120BHMSM000017-1.webp"
},
"parent_name": null
},
{
"id": 2745,
"name": "Multi Metal Macrame Swing",
"product_id": 96258,
"variation_id": 0,
"quantity": 1,
"tax_class": "",
"subtotal": "7375",
"subtotal_tax": "0",
"total": "7375",
"total_tax": "0",
"taxes": [],
"meta_data": [
{
"id": 32650,
"key": "product_extras",
"value": {
"product_id": 96258,
"title": "Multi Metal Macrame Swing",
"groups": [],
"purchased_lang": "en",
"aelia_currency": false
},
"display_key": "product_extras",
"display_value": {
"product_id": 96258,
"title": "Multi Metal Macrame Swing",
"groups": [],
"purchased_lang": "en",
"aelia_currency": false
}
},
{
"id": 32651,
"key": "_dokan_commission_source",
"value": "global",
"display_key": "dokan_commission_source",
"display_value": "global"
},
{
"id": 32652,
"key": "_dokan_commission_rate",
"value": "40",
"display_key": "_dokan_commission_rate",
"display_value": "40"
},
{
"id": 32653,
"key": "_dokan_commission_type",
"value": "fixed",
"display_key": "_dokan_commission_type",
"display_value": "fixed"
},
{
"id": 32654,
"key": "_dokan_additional_fee",
"value": "0",
"display_key": "_dokan_additional_fee",
"display_value": "0"
},
{
"id": 32655,
"key": "dokan_commission_meta",
"value": [],
"display_key": "dokan_commission_meta",
"display_value": []
},
{
"id": 32656,
"key": "_dokan_parent_order_item_id",
"value": "2741",
"display_key": "dokan_parent_order_item_id",
"display_value": "2741"
}
],
"sku": "IBT180150BHMMM000022",
"global_unique_id": "",
"price": 7375,
"image": {
"id": "96259",
"src": "https://ibtekr.club/wp-content/uploads/2025/03/Multi-metal-macrame-swing-1-IBT180150BHMMM000022-1.webp"
},
"parent_name": null
}
],
"tax_lines": [],
"shipping_lines": [],
"fee_lines": [],
"coupon_lines": [],
"refunds": [],
"payment_url": "https://ibtekr.club/checkout/order-pay/133378/?pay_for_order=true&key=wc_order_WiV83qyjA7Qww",
"is_editable": false,
"needs_payment": false,
"needs_processing": true,
"date_created_gmt": "2026-01-01T13:27:17",
"date_modified_gmt": "2026-01-01T13:27:28",
"date_completed_gmt": null,
"date_paid_gmt": null,
"currency_symbol": "EGP",
"stores": [
{
"id": 3,
"name": "Mohesham",
"shop_name": "Decoro",
"url": "https://ibtekr.club/store/mohesham/",
"address": {
"street_1": "",
"street_2": "",
"city": "",
"zip": "",
"country": "",
"state": ""
}
}
],
"store": {
"id": 3,
"name": "Mohesham",
"shop_name": "Decoro",
"url": "https://ibtekr.club/store/mohesham/",
"address": {
"street_1": "",
"street_2": "",
"city": "",
"zip": "",
"country": "",
"state": ""
}
},
"_links": {
"self": [
{
"href": "https://ibtekr.club/wp-json/wc/v3/orders/133378",
"targetHints": {
"allow": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE"
]
}
}
],
"collection": [
{
"href": "https://ibtekr.club/wp-json/wc/v3/orders"
}
],
"email_templates": [
{
"embeddable": true,
"href": "https://ibtekr.club/wp-json/wc/v3/orders/133378/actions/email_templates"
}
],
"customer": [
{
"href": "https://ibtekr.club/wp-json/wc/v3/customers/2044"
}
],
"up": [
{
"href": "https://ibtekr.club/wp-json/wc/v3/orders/133377"
}
]
}
},
"webhookUrl": ",
"executionMode": "production"
}
]
},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": ""
}
}
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: