Skip to main content

createOrder

Creates a new order with the specified attributes. You can create orders with customer details, shipping information, order items, and various fulfillment settings.

Requirements

  • User must have create_order permission
  • Valid sales channel must be specified or default channel will be used
  • All referenced entities (products, carriers, responsible persons) must exist
  • Order number must be unique within the brand context (if provided)

Address Requirements

Shipping addresses should include:

  • address1 - Street address
  • city - City name
  • country - ISO 2-letter country code
  • postalCode - Valid postal code for the country

Missing or invalid address fields will set order status to Pending with appropriate alerts.

Order Items Behavior

  • **Product Identification**: Items require either productId or sku
  • **Quantity**: Positive quantity required (missing quantity creates alert)
  • **Stock Management**: Inventory levels are automatically adjusted
  • **Fulfillment Method**: Automatically determined based on item processability:
    • LOCAL - All items processable locally
    • DROPSHIP - All items require dropshipping
    • MIXED - Combination of local and dropship items

Financial Settings

  • financialStatus: Defaults to PAID if not specified
  • shippingCost and totalTax cannot be negative
  • fulfillUnpaid: Allows fulfillment of orders with non-paid status

Fulfillment Configuration

  • autoFulfill: Automatically processes orders when conditions are met
  • allocateToExternal: Enables allocation to external/read-only facilities
  • localRouting: Bypasses external integration routing rules
  • Fulfillment settings inherit from sales channel unless explicitly overridden

Order Identification

  • orderNumber: Optional unique identifier within brand context
  • originOrderId: External system reference (must be unique if provided)
  • System generates UUID for internal order tracking

Error Responses

  • ValidationError: Business rule violations including:
    • Duplicate order numbers or origin IDs
    • Invalid sales channel, responsible person, or integration references
    • Negative financial amounts
    • Missing required fields for non-local order sources
  • PermissionError: Insufficient permissions for order creation
  • NotFoundError: Referenced entities (sales channels, products, etc.) not found

Order Status Alerts

Orders may be created with status alerts for:

  • Missing shipping address (missingShippingAddress)
  • Invalid postal codes (invalidShippingPostalCode)
  • Missing order items (noOrderItems)
  • Auto-fulfill enabled (autoFulfillEnabled)
  • Payment pending (paymentPending)

Integration Considerations

For orders from external systems:

  • sourceIntegrationId must match valid integration
  • Integration type must match originOrderSource
  • Additional validation rules may apply based on integration settings
createOrder(
input: CreateOrderInput!
): Order!

Arguments

createOrder.input ● CreateOrderInput! non-null input

Parameters for CreateOrder

Type

Order object

The order type. This type represents an order in the system.