Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Get orders by customer ID by status=any

Solved

Get orders by customer ID by status=any

wb1
Shopify Partner
64 2 17

I'm trying to get a customer's orders filtered by status=any. I know the customer has orders for sure, the results are always empty []. I've tried both Admin API and GraphQL.'

 

What am I missing??

 

Admin API:

 

 

https://${shop}/admin/api/2022-01/orders.json?query=customer_id:${id}&status=any

 

 

GraphQL:

 

 

{
  customer(id: "gid://shopify/Customer/${id}") {
    orders(first: 250, query: "status:any") {
      pageInfo {
        hasNextPage
        hasPreviousPage
      }
      edges {
        node {
          id
        }
        cursor
      }
    }
  }
}

 

Accepted Solution (1)

wb1
Shopify Partner
64 2 17

This is an accepted solution.

I figured this out, orders older than 60 days will not show up unless you request all orders access from the Partner app dashboard, NOT in the access scopes. Weird one...

 

https://community.shopify.com/c/shopify-apis-and-sdks/fetching-orders-of-a-customer/m-p/1233163/high...

View solution in original post

Replies 2 (2)

wb1
Shopify Partner
64 2 17

This is an accepted solution.

I figured this out, orders older than 60 days will not show up unless you request all orders access from the Partner app dashboard, NOT in the access scopes. Weird one...

 

https://community.shopify.com/c/shopify-apis-and-sdks/fetching-orders-of-a-customer/m-p/1233163/high...

wb1
Shopify Partner
64 2 17

After you get access to read all orders scope, this is the response from Partner support:

 

Thanks for contacting Shopify. Your request to read all orders has been approved. Please update your application to also include the OAuth scope read_all_orders (alongside read_orders or write_orders) for all orders access to take into effect.