A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I have an issue with the Python API package.
The customer.orders() function will not find all the orders associated with the given customer.
For example I have a customer with an order count of 1.
shopify.Customer.find(407915331645)
=> customer(407915331645)
shopify.Customer.find(407915331645).orders_count
=> 1
shopify.Customer.find(407915331645).orders()
=> []
shopify.Order.find(380765536317)
=> order(380765536317)
shopify.Order.find(380765536317).customer
=> customer(407915331645)
shopify.Order.find(380765536317).customer.orders()
=> []
The customer.orders() function returns an empty list when I know for certain there is an order tied to that account. The last line clearly illustrates the issue.
Not sure if this the Python packages fault or the API fault. Any help would be appreciated.
Hey @codyk12 ,
We touch on this in the API FAQ - if the order in question is older than 60 days and you are unable to successfully retrieve the data via API, you may be missing the necessary scope "read_all_orders". Querying for orders that are older than 60 days with only "read_orders" will typically return an empty array, like what you are seeing here.
I would check to see if your order is greater than 60 days old, and if so, make sure your app has the "read_all_orders" scope applied before trying again.
Best,
To learn more visit the Shopify Help Center or the Community Blog.