Dont know how get consistent numbers for /orders/count.json and /orders

Solved

Dont know how get consistent numbers for /orders/count.json and /orders

MichielfromNL
Shopify Partner
12 0 7

Who can help me here.
Í have been pulling my hair out to find a filter that gets me consistent counts for orders/count.json and /orders

For a smooth import UI, I first count how many orders there are, and then I read them
But whatever I try, the  numbers differ between the 2 API calls:

1) Getting number of Open,unfulfilled Orders in xxx with
https://---myshop--/admin/api/2023-01/orders/count.json?status=open&fulfillment_status=unshipped,par... 
->  22 orders 

then: 2) Importing open orders in XXX at 
https://---myshop--/admin/api/2023-01/orders.json?status=open&fulfillment_status=unshipped,partial&c...

-> 15 orders (in this page)

 

Where do I go wrong?  What filter should I use to get equal results ?


Help much appreciated!!


-----
Accepted Solution (1)
chris-sellboost
Shopify Partner
22 3 12

This is an accepted solution.

Archived orders are excluded, by default unfullfilled filter is equal to fulfillment_status in unshipped OR partial and opened status. 

Example video: https://streamable.com/ns6dah

View solution in original post

Replies 7 (7)

chris-sellboost
Shopify Partner
22 3 12

Hi @MichielfromNL 

The count.json endpoint has not the same behavior in its filters, example, orders fulfilled and not archived are included in the counts, in the orders.json listing, these orders are ignored.

Maybe we can interpret if exist any order unfulfilled and not archive, needs some action to be closed.

1. Count

/orders/count.json?status=any&fulfillment_status=unfulfilled

2. List

/orders.json?status=any&fulfillment_status=unfulfilled


Regards!

MichielfromNL
Shopify Partner
12 0 7

Thank you!
This indeed gives consistent counts.

But introduces a new problem: usually there are considerable amounts of cancelled orders that have not (yet) been archived. Which are then included in the count & in the JSON order list to be processed, which makes imports quite slow. 

Ideally there would be an option to use additional, negative filters such as :  "not cancelled" or "not archived" . Could I suggest that as a feature request ?

Regards,
Michiel  

-----
chris-sellboost
Shopify Partner
22 3 12

I don't know who can help you make this feature request, I am not a staff member.

However, I have solved this this in my store, I have a job on my own server to do that, archive these cancelled orders with the Admin API.

Regards

MichielfromNL
Shopify Partner
12 0 7

The problem is that these orders stay forever in the list as "unfulfilled" .
Did you find a way to remove them from the unfulfilled list too ?

  

-----
chris-sellboost
Shopify Partner
22 3 12

This is an accepted solution.

Archived orders are excluded, by default unfullfilled filter is equal to fulfillment_status in unshipped OR partial and opened status. 

Example video: https://streamable.com/ns6dah

MichielfromNL
Shopify Partner
12 0 7

Understand,
But then we are back to #1 : (See my original post) because with that filter,
    ?status=open&fulfillment_status=unshipped,partial
/orders/count.json and /orders.json  give different results.

 

-----
chris-sellboost
Shopify Partner
22 3 12

@MichielfromNL that's true, but it has always worked with that little inconsistency, that's why I recommend you to use status=any&fulfillment_status=unfulfilled


Regards!