Open shafaqat-ali-cms365 opened 4 months ago
Have you tried using postman to do a similar api call and see if that does return a value?
No, I don't have postman setup, otherwise I would have tried.
Hey @shafaqat-ali-cms365! I've just tested this myself and it seems to work fine. I've added it to ShopifySharp's integration tests in this commit and they pass without issue.
I think it might be a permission issue. Both the customers and orders are protected by special permissions that may not necessarily return errors. Off the top of my head, you'd need the following:
read_all_orders
scope.I have checked permissions again and looks every thing ok. I have also noticed that I can get non archived orders only and as soon as I fulfill them, I can't retrieve them. So it is something related to order status.
Your permissions look good, and so does the customer data privacy stuff. The fulfillment/order status thing is an interesting observation though, that sounds like it could be the problem. On the list filter, there's a property named Status
I think, try setting the value to "any"
and see if that returns some orders?
Note: I marked Status
property as obsolete at some point because there was no mention of it in Shopify's documentation. Maybe that has changed now, I'll have to check.
I have added the status field in the filter and I can confirm that I get orders returned but If I remove the status field, I don't get any order returned for the same customer. So looks like by default it returns open order only.
I am trying to get customer orders, here is my code
var filter = new CustomerSearchListFilter { //Searches for a customer from the United States with a name like 'Jane'. Query = $"email:{emailAddress}" }; var customer = (await customerService.SearchAsync(filter)).Items.FirstOrDefault(); if (customer != null) { var customerOrders =await customerService.ListOrdersForCustomerAsync(customer.Id.Value); }
but it is returning 0 orders.