Sales & CRMMu Mutation

createOrderGraph

Topics: Commerce

Create a complete order — header, customer, billing/shipping addresses, and lines — in a single transaction. Each nested input reuses the same type as the corresponding individual upsert mutation; nested ids are rejected because this mutation is create-only. The resolver also enforces customer:write / address:write / orderline:write when those nested inputs are provided.

Returns

CreateOrderGraphPayload!

Arguments

Converged order input including nested customer, addresses, and lines

Examples

Create Commerce Order

mutation CreateCommerceOrder($input: CreateOrderGraphInput!) {
  createOrderGraph(input: $input) {
    order { id orderNumber status totalAmount currency }
    lines { id lineNumber productName quantity lineTotal }
    errors { path message }
  }
}

Variables

{
  "input": {
    "order": {
      "orderNumber": "ORD-2042",
      "externalId": "SALES-2042",
      "customerId": "cus_01h455vb4pex5vsknk084sn02q",
      "currency": "EUR",
      "subtotalAmount": 1000,
      "taxAmount": 0,
      "totalAmount": 1000
    },
    "lines": [
      {
        "lineNumber": 1,
        "productName": "Packaging sleeves",
        "quantity": 500,
        "unitPrice": 2,
        "lineTotal": 1000,
        "currency": "EUR"
      }
    ]
  }
}
Exact field SDL
"""
Create a complete order — header, customer, billing/shipping addresses, and lines — in a single transaction. Each nested input reuses the same type as the corresponding individual upsert mutation; nested ids are rejected because this mutation is create-only. The resolver also enforces customer:write / address:write / orderline:write when those nested inputs are provided.
"""
createOrderGraph(
  """Converged order input including nested customer, addresses, and lines"""
  input: CreateOrderGraphInput!
): CreateOrderGraphPayload! @topic(names: ["commerce"]) @topic_example(names: ["commerce.create-order"])

Declared on Mutation. Access is checked by the platform for each operation.