GraphQL mutation inventoryBulkAdjustQuantityAtLocation

Shopify Expert
37 4 11


with my Nodejs app I connect to a courier FTP server to download a stock balance file two times a day. This file contains up to 30 thousands lines of text, each line is a product variant with unique SKU and available quantity. While downloading I use stream to convert data to a JavaScript object which result a list of arrays into array [["SKU",0]].

For your better understand this explanation, I will call this data: "source".


As you see we do not have inventoryItemId yet. So the idea is to:


1. queryGetInventoryItems(); 

create a query to get all inventoryItems id, sku and tracked status with something like this and maybe repeat this until "hasNextPage": false, so to get all inventoryItems from the shopify store into our memory and then return all id, sku and tracked status into a shopifyInventoryItems.JSON file. Is this the right way to get all inventory items?



2. mutationInventoryItemUpdateToTracked();

sometime inventoryItem does result "tracked": false, to solve should parse shopifyInventoryItems.JSON so for each "tracked": false, we perform see here



3. matchSkuToGetInventoryItemId();

Because only 60% of the source SKU correspond to an actual inventoryItemId, in the try catch we still have shopifyInventoryItems.JSON in memory so we compare source.JSON to match sku and write this two cases into source.json:

  • "no_match", push array like this ["sku",10,"title","","no_match"]
  • "tracked", push array like this ["sku",10,"title","inventoryItemId","tracked"]



4. mutationInventoryBulkAdjustQuantityAtLocation();

finally we have source quantity and shopify InventoryItemId into source.json so pass the list of the "tracked": true on file to this,


mutation {
  inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: {inventoryItemId: "", availableDelta: 0}, locationId: "")


Shopify Staff
Shopify Staff
1555 81 294

Point 1: As far as GraphQL goes, this is the correct way to paginate until you run out of inventory items provided to goal is to get all inventory items.


Sorry, is there more of a question you're looking for an answer to? Everything you're mentioning seems ok but feel free to clarify any additional intent behind your post.



48 2 8

This is great and helped me.  Of course, the bit issue is that there is no bulk update api, just an adjust which just make the whole thing more complicated

Shopify Expert
37 4 11

Hi @Alex 

On my inventory data source I have only the total quantity of items. Do you know if I can use "inventoryBulkAdjustQuantityAtLocation" or I must use "inventoryItemUpdate"?

As far as I see inventoryBulkAdjustQuantityAtLocation require "availableDelta" an input object which is described as: the Count by which to adjust the available quantity.

Instead of "available" Field of method inventoryItemUpdate which is described as: Quantity of items available at the location. Which is the value I actually have on my end.

Thank you,


inventoryBulkAdjustQuantityAtLocation -->

availableDelta -->

inventoryItemUpdate -->

available -->

Question about Shopify GraphQL mutation method inventoryBulkAdjustQuantityAtLocation seen at