GraphQL Order Filtering

HunkyBill
Shopify Expert
4476 45 484

Simple task, filter orders, but it does not work.

 

orders(first: 50, after: $cursor, query:"fulfillment_status:PENDING_FULFILLMENT AND financial_status:PENDING AND created_at:>=2021-04-09T00:00:00Z"

 

 

1. I get orders from 2021-04-08 in this set, but that is not terrible, can live with that

2. I get a PAID order in this set, but I am asking for financial_status:PENDING which clearly means NOT PAID

Who knows the correct way to get Fulfilled orders, that are not yet paid?

I changed it to fulfillment_status:fulfilled and financial_status:pending and that seemed to clean up things, but I am not confident this is 100% acceptable as it borrows from the RestAPI the filtering. Is that the thing? Use the old RestAPI filters?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
_JB
Shopify Staff
Shopify Staff
809 95 176

Hey @HunkyBill,

Seems like there's a few things going on with this request. I can provide some answers, but if you can provide a request_id from the response headers of this call I can dig in further.

 

1. I get orders from 2021-04-08 in this set, but that is not terrible, can live with that

Some clients require the timestamp to be surrounded in single quotes. Try query:"created_at:>'2021-04-09T00:00:00Z' ..."

 

2. I get a PAID order in this set, but I am asking for financial_status:PENDING which clearly means NOT PAID

This doesn't seem right. I've tested on my end and  financial_status:PENDING returns orders with pending payment only. I can dig further with that request_id.

 

I changed it to fulfillment_status:fulfilled and financial_status:pending and that seemed to clean up things, but I am not confident this is 100% acceptable as it borrows from the RestAPI the filtering. Is that the thing? Use the old RestAPI filters?

To clarify, did you use shipped or fulfilled for the fulfillment_status? The REST docs mention shipped as the correct value to get fulfilled orders, I tested to confirm as well. Otherwise this is correct, REST and GraphQL use the same values for filters. I can see how that's not intuitive since you can't infer the filter values from the GraphQL response, we'll work to get this clarified in the docs.

 

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

HunkyBill
Shopify Expert
4476 45 484

Quoting a date does not help. But thanks anyway... it is close enough... too bad it is not actually precise though. Somewhere in the interpretation of dates, there is a mismatch going on, and we're no longer comparing apples to apples.

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes