orders

List orders with cursor pagination and filters
View as Markdown

The orders query returns OrderConnection.

Arguments

ArgumentTypeRequiredDescription
afterStringNoCursor to paginate forward from.
beforeStringNoCursor to paginate backward from.
customerStringNoFilter by customer ID.
firstIntNoReturn the first N results.
inStockBooleanNoFilter by item stock: true returns orders where every item’s resolved product is live; false returns orders with at least one out-of-stock item; omit for no filter. Resolution follows item.product → subscription_component.product → subscription.product.
includePrepaidOrdersBooleanNoInclude prepaid orders in results. Defaults to true.
lastIntNoReturn the last N results.
placeDateNoFilter by exact placement date (YYYY-MM-DD).
placeEndDateNoFilter orders placed on or before this date (YYYY-MM-DD).
placeStartDateNoFilter orders placed on or after this date (YYYY-MM-DD).
status[Int!]NoFilter by order status codes.
subscriptionStringNoFilter by subscription public ID.

Return type: OrderConnection

FieldTypeRequired
edges[OrderEdge!]!Yes
pageInfoPageInfo!Yes

Examples

List recent orders for a customer

Retrieve a customer’s order history with basic info

1query {
2 orders(customer: "cust123", first: 10) {
3 edges {
4 node {
5 publicId
6 status
7 subTotal
8 total
9 place
10 created
11 items {
12 nodes {
13 quantity
14 product {
15 name
16 externalProductId
17 }
18 }
19 }
20 }
21 }
22 }
23}

List orders with pagination

Page through a customer’s orders using cursor-based pagination

1query {
2 orders(customer: "cust123", first: 10, after: "cursor123") {
3 edges {
4 cursor
5 node {
6 publicId
7 status
8 subTotal
9 total
10 place
11 created
12 }
13 }
14 pageInfo {
15 hasNextPage
16 hasPreviousPage
17 startCursor
18 endCursor
19 }
20 }
21}

Get subscription details by customer

Detailed orders by customer

1query {
2 orders(customer: "cust123", first: 25) {
3 edges {
4 node {
5 publicId
6 status
7 subTotal
8 total
9 place
10 items {
11 nodes {
12 publicId
13 quantity
14 price
15 totalPrice
16 product {
17 name
18 externalProductId
19 sku
20 }
21 subscription {
22 publicId
23 every
24 everyPeriod
25 }
26 }
27 }
28 }
29 }
30 }
31}

Get subscription details by subscription

Retrieve orders for a specific subscription with line item details

1query {
2 orders(subscription: "sub123", first: 25) {
3 edges {
4 node {
5 publicId
6 status
7 subTotal
8 total
9 place
10 created
11 items {
12 nodes {
13 publicId
14 quantity
15 price
16 totalPrice
17 product {
18 name
19 externalProductId
20 sku
21 }
22 subscription {
23 publicId
24 every
25 everyPeriod
26 }
27 }
28 }
29 }
30 }
31 }
32}