Skip to main content

updateOrderItems

Updates order items for a V2 order in draft or pending state.

This mutation replaces all existing order items with the provided items array. The order must be in "draft" or "pending" state to update items.

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" or "pending" state
  • Order must be using the V2 aggregate (internal_version = "v2")
  • Order items array must be provided and contain at least one item

Arguments

  • order_id (required): The ID of the order to update
  • order_items (required): Array of order items that should replace all existing items
  • brand_id (optional): The brand ID (can be provided via X-Brand-Id header)

Order Items

Each order item should include:

  • product_id or sku (at least one required): Product identifier
  • quantity (required): Quantity must be greater than 0
  • price (optional): Item price
  • discount (optional): Item discount
  • external_id (optional): External identifier for the item

Behavior

  • Replaces all existing order items with the provided items
  • Validates product existence (adds alert if product not found but continues)
  • Validates quantity is positive
  • Returns the updated order with new order items
updateOrderItems(
input: UpdateOrderItemsInput!
): V2Order!

Arguments

updateOrderItems.input ● UpdateOrderItemsInput! non-null input

Parameters for UpdateOrderItems

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.