Skip to main content

createDraftOrder

Creates a new draft order in the V2 orders state machine.

Draft orders can have incomplete data and support all optional order properties. The order will be created with a "draft" status and can be modified before being committed.

Requirements

  • User must have create_order permission
  • Valid brand context must be provided (via argument or X-Brand-Id header)
  • Order number must be unique within the brand context (if provided)

Arguments

All arguments are optional except for the brand context. This allows for flexible draft order creation where data can be added incrementally.

Order Properties

  • **Order Identification**: order_number (optional, must be unique if provided)
  • **Sales Channel**: sales_channel_id (optional, system may use default)
  • **Responsible Person**: responsible_id (optional party/person ID)
  • **Addresses**: Shipping and billing address details (all optional)
  • **Order Items**: order_items array (optional)
  • **Notes**: order_notes array (optional)
  • **Metadata**: order_metadata JSON (optional)
  • **Tags**: order_tags array (optional)
  • **Customer**: customer_id (optional, for linking to existing customer)

Behavior

  • Creates order with "draft" status
  • All properties are optional and can be modified later
  • No business rule validation for incomplete data (per state machine spec)
  • Returns the created order with draft status
createDraftOrder(
input: CreateDraftOrderInput!
): V2Order!

Arguments

createDraftOrder.input ● CreateDraftOrderInput! non-null input

Parameters for CreateDraftOrder

Type

V2Order object

The V2 order type. This type represents a V2 order in the system with only the fields necessary for draft creation and details.