Retrieve a list of orders is not working properly

gopalakrishnan
Shopify Partner
5 0 0

Hi Team,

We are trying to fetch a list of orders specific to a customer. But we are getting an empty list in the response.
We tried using both SDK and API, and neither of them worked.
API: https://customer.myshopify.com/admin/api/2022-01/orders.json
API Response: 

{
"orders": []
}

NOTE: I was able to retrieve the draft orders with the same access token
https://customer.myshopify.com/admin/api/2022-01/draft_orders.json

SDK: orders = with_shopify_session { ShopifyAPI::Order.where(customer_id: customer.id) }

Can you help me to solve the issue?
Thanks,

Replies 6 (6)

csam
Shopify Staff (Retired)
267 40 51

Hi @gopalakrishnan 

 

I'm wondering if the orders you're trying to retrieve are over 60 days old? If that's the case, your app will need to have the read_all_orders access scope added in order to access orders older than 60 days. Please let me know if you have further questions!

To learn more visit the Shopify Help Center or the Community Blog.

gopalakrishnan
Shopify Partner
5 0 0

Hi @csam,
We are only trying to retrieve the orders created in the last 30 days. The seller has read_orders access.

1. Should not the API return the orders created within 60 days by default? We didn't pass any parameter to the API to retrieve the 60-day old orders.

2. Is it possible to get the corresponding errors if something is wrong with the API request?

csam
Shopify Staff (Retired)
267 40 51

Hi @gopalakrishnan 

 

Okay, thanks for confirming that. The correct format for making this request via the REST API directly would be /admin/api/2021-10/customers/207119551/orders.json 

 

If you're still having trouble with this, we're going to need a little more info for this issue - could you please fill out all fields on the Report an Issue form found under the Partners Support section? Any additional information you can provide around this issue would be very helpful. This will let us take a look in the logs and at the store, to see what might be causing the behaviour.

 

Thanks!

 

To learn more visit the Shopify Help Center or the Community Blog.

gopalakrishnan
Shopify Partner
5 0 0

Hi @csam,

I get the same result(empty list) with the "/admin/api/2021-10/customers/207119551/orders.json" API. I will update more details. Thanks.

kaikoamadrid
Visitor
1 0 0

Hi, i've the same problem. Have you resolved it?

Please, i'm receiving the same result(empty list) and i need help. 

Thank you,

IGIT
Shopify Partner
44 0 7

Maybe the same issue here. We are receiving orders but only one or two, when we may have taken 50 - 100 orders over the day. We are using the created_at_min and _max parameters. Or is this another issue?