How to update stock as fulfilment service

Hi,

I need to switch to GraphQL. The REST API was nice and simple. But what is the proper way with GraphQL to manage inventory for you fulfilment service? Which query do I need to use to update/sync/check stock levels of ‘my’ location?

Regards, Peter

Hi Peter,

So the important GraphQL queries and mutations you’ll be working with for managing inventory with fulfilment services are:

I’d recommend checking out the docs links above and testing out different scenarios. If you have more questions after that please ask them here.

Hi Liam,

Thanks for your reply. And what if there are 1.000 items managed by our fulfilment service app? Do I need to read them all one by one and adjust quantities if needed?

Regards, Peter

Hello @RedYellowBlue

If you wanted to get what all the inventory quantities was at a single location, you could do a query like this along with paging to get those values for each inventory item to avoid doing a query for each item. As well, you would need to specify the quantity names you are interested in

query location {
  location(id: "gid://shopify/Location/LOCATION-ID") {
    inventoryLevels(first: 250) {
      nodes {
        item {
          id
        }
        quantities(names: ["available", "committed"]) {
          name
          quantity
        }
      }
    }
  }
}

As of now, yes, you can only adjust quantities at a single inventory item for a single location at a time.

I hope that helps.

1 Like