How can I get order_number using GraphQL

Solved
developement_st
Shopify Partner
7 0 3

Hi everyone!
I want to get an order using GraphQL.
Most will work but you can not get order_number.
Does anyone know how to get order_number?

I tried following:

{
  order(id: "gid://shopify/Order/order-id") {
    id
    name
    orderNumber
  }
}

but I couldn't get order_number

Busfox
Shopify Staff
Shopify Staff
619 48 94

This is an accepted solution.

Hi @developement_st,

 

With GraphQL, the schema will have every available field shown. You can view it here: https://help.shopify.com/en/api/graphql-admin-api/reference.

 

In this case, the order_number field, as it is in the REST API, is not currently exposed in the GQL API. That said, the name field will include the order_number.

 

Cheers,

kcloop
New Member
1 0 0

The order name does contain the order number, but it can also have a prefix and/or suffix, and/or an incremental number, depending on how the shop is configured, it seems. How can we accurately extract the order number from what is available on GraphQL only?

0 Likes