Get orders by customer ID by status=any

Solved
wb1
Shopify Partner
61 2 15

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
61 2 15

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
61 2 15

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
61 2 15

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.