GraphQL query for fulfilled orders & other filter params

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.

 

0 Likes
Shopify Partner
21 0 4

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.
0 Likes
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

0 Likes
Shopify Partner
21 0 4
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.
0 Likes
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.

0 Likes
Tourist
9 1 0

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
						}
				}
		}
}
0 Likes