GraphQL - get remaining fulfillable quantity by vendor of the line item variant

New Member
1 0 0

Hi guys, I wanted to pull the remaining fulfillable quantity for all line items whose variant belongs to a certain vendor. Is this possible through the GraphQL API? I browsed the Explorer and managed to get to the query below but I haven't been able to figure out how to only return orders that have a line item with a variant belonging to a particular vendor.

 
{
  query: orders(first: 10, query:"created_at:>'2019-12-01T00:00:00Z'") {
    edges {
      node {
        lineItems(first: 10) {
          edges {
            node {
              fulfillableQuantity
              variant {
                id
                title
              }
              product {
                title
                vendor
              }
            }
          }
        }
      }
    }
  }
}
 
Thanks for any help!
0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 127

Hey @terenperera ,

 

As it currently stands, there is no out-of-the-box way in the GraphQL Admin API (or in the REST Admin API) to only return orders that have a line item with a variant belonging to a particular vendor. Your best bet would be to query all orders with the query you provided, and parse through the results to find the orders that contain variants from a specific vendor. 

 

One work around solution could be to update every order on your store to have a tag that indicates each vendor responsible for each line item in that order. Then all you would need to do is use the following GraphQL query and you could return only the orders that have a line item with a variant belonging to a particular vendor: `query: orders(first: 10, query:"tag:'particular_vendor'") { ... }` 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes