Discussing APIs and development related to customers, discounts, and order management.
When I call the REST API's orders/count endpoint, I can't filter by more than one financial_status. For example:
https://{store_name}.myshopify.com/admin/api/2024-01/orders/count.json?financial_status=refunded,partially_refunded
This query should return a count of orders that have either the refunded or partially refunded financial_status. Instead, however, I get a count of all open orders.
However, if I call it with just one order status, it works correctly:
https://{store_name}.myshopify.com/admin/api/2024-01/orders/count.json?financial_status=refunded
This returns the correct number of open orders with the refunded status.
I initially tried this with the shopify-api Node REST client in my app, using the rest.Order.count function, and that's where I noticed this behavior. I then tried directly in an API client and got the same results.
fulfillment_status has the same issue.
Interestingly, if I remove the /count and simply try to filter orders by financial_status, it works. I get only orders that meet one of the specified financial statuses.
This seems like a bug--if we can retrieve orders with multiple financial_status filters, why can't we retrieve a count?
I can get around this by calling the orders endpoint with a pagination loop until I get every past order id for different statuses, then combine the counts, but that is obviously way less efficient. And it gets even more inefficient when combined with fulfillment_status.
Anyone know what's up with the orders/count endpoint?