Trying to determine why I am not able to retrieve all orders under my test store (so that I can understand what is happening in Production as well)
As you can see above, I have 13 orders placed on my test store, but I can only retrieve 11. The two orders placed in august, that I have marked in red, are not reachable. Even when I try to look them up by searching by their ID's
Requests I am using:
sharing my access token here, its fine. this is just a test store.
X-Shopify-Access-Token: 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
https://vitor-dawn-dev-store.myshopify.com/admin/api/2021-10/orders.json?status=any
- gives me the 11 orders
https://vitor-dawn-dev-store.myshopify.com/admin/api/2021-10/orders/count.json?status=any
- returns 13 (The number I expected).
https://vitor-dawn-dev-store.myshopify.com/admin/api/2021-10/orders/4062335991963.json
- one of the missing order's ID. gives me a 404 Not found.
Some sample IDS:
Valid and reachable order ID sample: 4270842052763
Order ID's that aren't reachable: 4062335991963
and 4062362665115
Also tried through graphQL, but got the same results.
Does anyone know why this is happening?
CodePudding user response:
From the Shopify REST API docs for Orders
Only the last 60 days' worth of orders from a store are accessible from the Order resource by default. If you want to access older orders, then you need to request access to all orders. If your app is granted access, then you can add the read_all_orders scope to your app along with read_orders or write_orders. Private apps are not affected by this change and are automatically granted the scope.
Your app needs read_all_orders scope to be able to fetch data for orders created more that 60 days ago.