Skip to main content

saveDraftOrder

Saves/updates an existing draft order in the V2 orders state machine.

This mutation allows updating draft orders without changing their state. The order remains in "draft" status but all its properties can be modified.

Requirements

  • User must have update_order permission
  • Valid brand context must be provided (via argument or X-Brand-Id header)
  • Order must exist and be in "draft" state
  • Order must be using the V2 aggregate (internal_version = "v2")
  • Order number must be unique within the brand context (if changed)

Arguments

All arguments except order_id are optional. Only provided fields will be updated.

Order Properties

  • **Order Identification**: order_number (optional, must be unique if changed)
  • **Sales Channel**: sales_channel_id (optional)
  • **Responsible Person**: responsible_id (optional party/person ID)
  • **Addresses**: Shipping and billing address details (all optional)
  • **Order Items**: order_items array (optional, replaces existing items)
  • **Notes**: order_notes array (optional, adds new notes)
  • **Metadata**: order_metadata JSON (optional)
  • **Tags**: order_tags array (optional, adds new tags)
  • **Customer**: customer_id (optional)

Behavior

  • Updates order properties without changing state (remains "draft")
  • Only provided fields are updated
  • Order items are replaced if provided
  • Notes and tags are added (not replaced)
  • No new OrderStatus record is created (state unchanged)
  • Returns the updated order with draft status
saveDraftOrder(
input: SaveDraftOrderInput!
): V2Order!

Arguments

saveDraftOrder.input ● SaveDraftOrderInput! non-null input

Parameters for SaveDraftOrder

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.