Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: GraphQL query for fulfilled orders & other filter params

Solved

GraphQL query for fulfilled orders & other filter params

bmarshall511
Tourist
4 0 1

Trying to query fulfilled orders using GraphQL, but the following keep pulling all orders:

{
    orders(first: 50, query:"fulfillment_status:fulfilled") {
      edges {
        node {
          id
          name
          note
          createdAt
          displayFinancialStatus
          displayFulfillmentStatus
          totalPriceSet {
            shopMoney {
              amount
            }
          }
          customer {
            id
            displayName
          }
        }
      }
    }
  }

What am I doing wrong? Also would look to use other filter params in the same query like created_at and wondering how to do multiple calls in the same query. Looked through https://help.shopify.com/en/api/getting-started/search-syntax but if I'm reading it right, the above should work. Not sure what I'm missing here.

 

Accepted Solution (1)
RobFarmLink
Shopify Partner
43 2 44

This is an accepted solution.

This seems to have changed recently. Try using one of these:

 

 

fulfillment_status:unshipped
fulfillment_status:shipped
-fulfillment_status:unshipped
-fulfillment_status:shipped

 

 

View solution in original post

Replies 8 (8)

emilbryggare
Shopify Partner
21 0 16

Hi @bmarshall511 ,

 

The fulfillment_status is actually wrong. The documentation is lacking for GraphQL.

The valid fulfillment_status values can be found here.

Filter orders by their fulfillment status.

(default: any)
shipped: Show orders that have been shipped.
partial: Show partially shipped orders.
unshipped: Show orders that have not yet been shipped
any: Show orders of any fulfillment status.

So your request should be:

{
    orders(first: 50, query:"fulfillment_status:shipped") {
      edges {
        node {
          id
          name
          note
          createdAt
          displayFinancialStatus
          displayFulfillmentStatus
          totalPriceSet {
            shopMoney {
              amount
            }
          }
          customer {
            id
            displayName
          }
        }
      }
    }
  }

Hope it helps!

Founder of Evermark - Smart and automated Facebook ads for your Shopify store.
bmarshall511
Tourist
4 0 1

Thanks, but that's actually for the RestAPI, I'm using graphql. Was able to figure it out with the ":<=" comparer.

 

ex: fulfillment_status:<=fulfilled

emilbryggare
Shopify Partner
21 0 16
Yes, I know. The REST and GraphQL API use the same valid values for the fulfillment_status and from what I saw that part is missing from the GraphQL documentation.

Anyways, glad it worked out for you.
Founder of Evermark - Smart and automated Facebook ads for your Shopify store.
bcronje
Tourist
5 0 1

Thank you Emil, your answer is indeed right, it saved me quite a bit of time trying to figure out why it wasn't working.

theptrk
Tourist
9 1 5

Hi all, 

This still doesn't work for me. If I filter by the "null" value I still get fulfillable=true

 

##	Filtering	connections	using	the	query	parameter
{
		orders(first:10, query:"fulfillment_status:null")	{
				edges	{
						node	{
								id
								name
								displayFulfillmentStatus	
                fulfillable
						}
				}
		}
}

thelimit
Shopify Partner
2 0 0

I found that this requires "status:any" in the query in order for the "fulfillment_status" to function as advertised.

 

So something like this:

{
orders(first:10, query:"status:any&fulfillment_status:UNFULFILLED") {
edges {
node {
id
name
displayFulfillmentStatus
}
}
}
}

 

RobFarmLink
Shopify Partner
43 2 44

This is an accepted solution.

This seems to have changed recently. Try using one of these:

 

 

fulfillment_status:unshipped
fulfillment_status:shipped
-fulfillment_status:unshipped
-fulfillment_status:shipped