Sales Orders Queries

Access sales orders, line items, allocation status, and shipping progress.

Order — Returns a single sales order by id

query GetOrder($id: ID!) {
  Order(id: $id) {
    id
    label
    status
    total
    dated_at
    customer { id label }
    shipping_status
    delivery_status
    line_items {
      id
      variant { id label }
      quantity
      price
    }
  }
}

Orders — Returns a paginated list of sales orders with sorting and filters

query Orders(
  $where: QueryOrdersWhereWhereConditions,
  $orderBy: [QueryOrdersOrderByOrderByClause!],
  $search: String,
  $first: Int,
  $page: Int
) {
  Orders(
    where: $where,
    orderBy: $orderBy,
    search: $search,
    first: $first,
    page: $page
  ) {
    paginatorInfo {
      total
      currentPage
    }
    data {
      id
      label
      status
      dated_at
      total
      customer { id label }
    }
  }
}

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringOrder number.
statusOrderStatusGlobal workflow status.
notesStringPublic notes for the PDF.
internal_notesStringPrivate office notes.
total_unitsFloatCalculated sum of all items quantity.
total_units_aggregateFloatSum of units for filtered results.
update_on_handBooleanTrue if this order impacts on-hand stock.
available_for_shippingBooleanTrue if items are in stock and ready to ship.
dated_atDateSales order date.
created_atDateCreation date.
shipping_atDateEstimated shipping date.
location_labelStringOrigin warehouse name.
need_reorderBooleanTrue if stock is insufficient to fulfill.
shipping_statusShippingStatusProgress of shipping orders.
delivery_statusDeliveryStatusProgress of actual delivery.
return_statusReturnStatusProgress of associated returns.
stock_allocation_statusStockAllocationStatusStock reservation status.
billing_statusBillingStatusProgress of associated invoices.
payment_statusPaymentStatusOverall payment progress.
committed_quantityFloatQuantity assigned to this order.
uncommitted_quantityFloatQuantity pending assignment.
reserved_quantityFloatQuantity reserved in inventory.
shipped_quantityFloatQuantity documented in shipping orders.
delivered_quantityFloatQuantity actually out of stock.
returned_quantityFloatQuantity returned by customer.
unreturned_quantityFloatQuantity remaining to be returned.
billed_quantityFloatQuantity included in invoices.
unbilled_quantityFloatQuantity still pending billing.
paid_quantityFloatQuantity already paid for.
unpaid_quantityFloatQuantity still pending payment.
billed_amountFloatValue already invoiced.
unbilled_amountFloatValue still pending invoice.
paid_amountFloatValue already paid.
unpaid_amountFloatValue still pending payment.
exchange_rateFloatCurrency exchange rate.
tax_typeTaxType"Exclusive" or "Inclusive".
subtotalFloatNet amount before taxes.
total_without_taxFloatTotal excluding tax.
total_ecotaxFloatSpecific environmental tax sum.
totalFloatFinal order total.
external_referenceStringExternal system reference.
for_the_attention_ofStringRecipient contact name.
sourceStringOrigin of the order (e.g. "B2B Store").
default_discountFloatGlobal discount value.
discount_typeDiscountType"percentage" or "amount".
customerCustomerAssociated customer.
currencyCurrencyOrder currency.
price_levelPriceLevelApplied price level.
account_representativeAccountRepresentativeLinked sales rep.
seasonSeasonCommercial season.
payment_informationPaymentInformationBank details for payment.
billing_addressAddressOrder billing address.
shipping_addressAddressDocumented delivery address.
line_items[LineItemOrder]List of products ordered.
total_taxes[DocumentTaxRate]List of taxes applied.
estimates_countIntNumber of source estimates.
estimates[Estimate]Linked estimates history.
invoices_countIntNumber of linked invoices.
invoices[Invoice]Associated invoices.
shipping_orders_countIntNumber of linked deliveries.
shipping_orders[ShippingOrder]Linked shipping documents.
product_returns_countIntNumber of associated returns.
product_returns[ProductReturn]Returns history.
refunds[Refund]Linked refunds.
credit_notes[CreditNote]Linked credit notes.
integrations[Integration]Connected platform links.
purchases_countIntNumber of linked drop-shippings/purchases.
purchases[Purchase]Procurement links.
stock_adjustments_countIntNumber of linked adjustments.
stock_adjustments[StockAdjustment]Associated stock movements.
email_histories[EmailHistory]Communication logs.
files[File]Attachments.
pdf_templatePdfTemplateDesign used for PDF generation.
has_batch_numbersBooleanTrue if order items use batch tracking.
tracking_completedBooleanTrue if all tracking requirements are met.
custom_fields[EntityCustomField]Custom fields for this entity.

Filters

The following fields can be used in the where parameter:

id, label, notes, status, total_units, update_on_hand, dated_at, created_at, updated_at, customer_id, available_for_shipping, shipping_at, committed_quantity, uncommitted_quantity, delivered_quantity, shipped_quantity, reserved_quantity, returned_quantity, unreturned_quantity, shipping_orders_count, product_returns_count, purchases_count, need_reorder, variant_id, variant_label, variant_sku, location_id, batch_number_id, has_batch_numbers, tracking_completed, shipping_status, delivery_status, return_status, stock_allocation_status.

Example Filters:

FieldExample
status{ "column": "STATUS", "operator": "EQ", "value": "active" }
customer_id{ "column": "CUSTOMER_ID", "operator": "EQ", "value": 100050 }
delivery_status{ "column": "DELIVERY_STATUS", "operator": "EQ", "value": "not_delivered" }

Sorting

You can sort results using the orderBy parameter:

  • id
  • label
  • notes
  • total_units
  • status
  • update_on_hand
  • dated_at
  • created_at
  • shipping_at
  • customer_id
  • customer_label
  • committed_quantity
  • uncommitted_quantity
  • shipped_quantity
  • delivered_quantity
  • reserved_quantity
  • returned_quantity
  • unreturned_quantity

Grouping Options

You can group sales orders using the groupBy parameter for reports:

FieldDescription
idGroup by internal ID.
yearGroup by year of dated_at.
monthGroup by month of dated_at.
dayGroup by day of dated_at.

Enums

OrderStatus

ValueDescription
unpublishedDraft status (hidden).
pending_validationAwaiting approval.
activeConfirmed and in progress.
completedOrder fully fulfilled and closed.
archivedMoved to history.
cancelledDocument voided.

ShippingStatus

ValueDescription
not_shippedNo shipping order created.
partially_shippedOne or more shipping orders created.
shippedAll items included in shipping orders.

DeliveryStatus

ValueDescription
not_deliveredStock not yet adjusted for delivery.
partially_deliveredSome items out of stock.
deliveredAll items marked as delivered.

BillingStatus

ValueDescription
not_billedNo invoice generated.
partially_billedPartial invoices created.
fully_billedTotal value reached in invoices.

PaymentStatus

ValueDescription
unpaidNo payment recorded yet.
partially_paidPartial payment received.
paidTotal value fully paid.

StockAllocationStatus

ValueDescription
not_allocatedNo stock reserved.
partially_allocatedSome items reserved.
allocatedAll items reserved in stock.

DiscountType

ValueDescription
amountFixed discount amount.
percentagePercentage-based discount.

TaxType

ValueDescription
exclusiveTax calculated on top of the net price.
inclusiveTax included in the displayed price.