{
  "schema_version": "1.0.0",
  "id": "webflow-order-packing-note",
  "title": "Send a Webflow order to Airtable and the warehouse",
  "category": "ecommerce",
  "difficulty": "intermediate",
  "featured": false,
  "description": "Record each Webflow e-commerce order in Airtable with a readable item list and email the same pick list to the warehouse.",
  "tags": [
    "webflow",
    "airtable",
    "orders",
    "fulfilment",
    "gmail"
  ],
  "apps": [
    "Webflow",
    "Code by Zapier",
    "Airtable",
    "Gmail"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 3 steps after the trigger"
    ]
  },
  "tasks": {
    "typical": 3,
    "max": 3
  },
  "trigger": {
    "app": "Webflow",
    "event": "New Order",
    "kind": "instant",
    "title": "New Webflow order",
    "why": "Fires when a Webflow e-commerce order is placed.",
    "config": {
      "Site": "YOUR_WEBFLOW_SITE"
    },
    "outputs": [
      "order_id",
      "customer_name",
      "customer_email",
      "shipping_address",
      "line_item_names",
      "line_item_quantities",
      "line_item_prices",
      "line_item_skus",
      "total",
      "currency",
      "created_on"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "lines",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Turn the line items into a pick list",
      "why": "Rebuilds one readable line per product (\"2 x Linen apron (APR-01) @ 24.00\") and checks the lists line up.",
      "code": {
        "language": "javascript",
        "module": "line-items",
        "file": "code/line-items.js"
      },
      "input_data": {
        "titles": "{{trigger.line_item_names}}",
        "quantities": "{{trigger.line_item_quantities}}",
        "prices": "{{trigger.line_item_prices}}",
        "skus": "{{trigger.line_item_skus}}",
        "currency": "{{trigger.currency}}"
      },
      "outputs": [
        "line_count",
        "unit_count",
        "subtotal",
        "summary",
        "missing_skus",
        "mismatch"
      ]
    },
    {
      "key": "record",
      "kind": "action",
      "app": "Airtable",
      "event": "Create Record",
      "title": "Add the order to the tracker",
      "why": "One record per order with the pick list in a long-text field and a status the warehouse updates.",
      "fields": {
        "Base": "Orders",
        "Table": "Orders",
        "Order ID": "{{trigger.order_id}}",
        "Customer": "{{trigger.customer_name}}",
        "Email": "{{trigger.customer_email}}",
        "Items": "{{lines.summary}}",
        "Units": "{{lines.unit_count}}",
        "Total": "{{trigger.total}}",
        "Status": "To pick",
        "Needs check": "{{lines.mismatch}}"
      },
      "outputs": [
        "id",
        "created_time"
      ]
    },
    {
      "key": "warehouse",
      "kind": "action",
      "app": "Gmail",
      "event": "Send Email",
      "title": "Email the pick list to the warehouse",
      "why": "The warehouse works from email, so it gets the address and the pick list in one message.",
      "fields": {
        "To": "YOUR_WAREHOUSE_EMAIL",
        "Subject": "Pick and ship: Webflow order {{trigger.order_id}}",
        "Body Type": "plain",
        "Body": "Please pick and ship:\n\n{{lines.summary}}\n\nUnits: {{lines.unit_count}}\nShip to:\n{{trigger.customer_name}}\n{{trigger.shipping_address}}\n\nReply with the tracking number. Airtable record: {{record.id}}",
        "From Name": "YOUR_STORE_NAME orders"
      },
      "outputs": [
        "id",
        "thread_id"
      ]
    }
  ]
}
