Graphql InventoryLevels Query

Thomas_Lang1
Shopify Partner
171 4 32

Hi there,

We are facing an issue with stores that have a lot of products, we request bulk operation export for the inventorylevels per location of the customer.

the issue is the customer has 100k+ products, we get a LOT of data and the export takes really long to generate, which isn't ideal because we need to export it for +/- 30 locations.

the current graphql query:

 

  mutation {
  bulkOperationRunQuery(
    query:""" { 
  location( id: "gid://shopify/Location/xxxxxx") {
     inventoryLevels{
          edges {
            node {
              id
              available
              incoming
              item {
                variant{
                  id
                  sku
                  product {
                    id
                    title
                  }
                }
              }
            }
          }
        }
  }
}
   """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

 

 

Now with the query option from graphql we were hoping to do something like this:

nventoryLevels(query : "available > 0"){
          edges {
            node {
              id
              available
........ etc

 

so that the export would only containt the relevant (in stock) inventorylevels for the location

 

but we get this error message:

 

Thomas_Lang1_0-1626427285718.png

 

 

here is a runnable test for the graphql explorer (without the bulkoperation export)

query{
  locations(first:10){
    edges{
      node{
        name
        inventoryLevels(first:10, query:"available >0") {
          edges{
            node{
            	id
              incoming
              available
            }
          }
        }
      }
    }
  }
}

 

it would be super useful to only get the relevant products, because now for 1 location I need to download a 39MB jsonl file with 129121 inventorylevels. where in reality this location will only have 6500 products available

0 Likes