Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

get order by name/number with graphQL

iozyigit
Shopify Partner
28 2 2

I have old custom app that finds order detail by entering order number from customer.

Seems like this is not working anymore. Did Shopify disable this? I see new admin graphQL api allows to query by id(internal id) but customers only know order number.

 

How should I get order ID by using order name/number?

Any idea?

https://www.linkedin.com/in/ismailozyigit/
Accepted Solution (1)

ocastx
Shopify Partner
27 5 8

This is an accepted solution.

Hi Iozyigit,

 

to find an order by order number using the GraphQL Admin API you can use the following query: 

 

 

{
  orders(first:10, query:"name:1010") {
    edges {
      node {
        id
        name
      }
    }
  }
}

 

 

In this case, the query runs for order number #1010 and replies the ID and order name.

 

Hope this helps!

View solution in original post

Replies 2 (2)

ocastx
Shopify Partner
27 5 8

This is an accepted solution.

Hi Iozyigit,

 

to find an order by order number using the GraphQL Admin API you can use the following query: 

 

 

{
  orders(first:10, query:"name:1010") {
    edges {
      node {
        id
        name
      }
    }
  }
}

 

 

In this case, the query runs for order number #1010 and replies the ID and order name.

 

Hope this helps!

iozyigit
Shopify Partner
28 2 2

Thank you very much.

Seems like this was my problem, need to update my app. api was version 2022-01.

https://shopify.dev/docs/apps/store/data-protection/protected-customer-data

https://www.linkedin.com/in/ismailozyigit/