variant item id in product not always match inventorylevel id

9 0 1

I'm reaching out because I have a bit of a confusion regarding our store and specifically products and inventory.  What I'm trying to do is correlate the Shopify internal item ID to our sku or the ERP backend product ID.  For example


The first number is the inventory item ID or the item ID in the variant object of the product object in Shopify and the second is the SKU or product ID.

I'm trying to build a cross reference table so it's easier to perform things like inventory updates and pricing updates without having to do a lot of rest calls in this way we have Shopify item information in our databases.

The problem I ran into is that when I attempted to correlate the SKU that is in Shopify against the SKU we have in our system I ran into a situation where even in Shopify , the list of products and their variant does not match that in the inventory levels.

40038156566699  this had a match between product variant item id and itemlevel item id.

40038768509099 not in product list.  this did not.

So in the example there the first line is in inventory item ID that does exist in the product list variant list for that product. The second indicates that when I use that item ID, and attempted to look up against the product list that has the SKU, it did not appear in the product list. What am I missing?

Since there seems to be no direct rest API that would perform a look up I've been internal Shopify item ID given an SKU, my attempt at doing this consisted of four parts


  1. Get a list of all products in store using the product's rest API.  Load the variant item ID in the SK you into a dictionary object
  2. get a list of all locations under the store using the locations rest API
    1. I did this even though we only have one location in the anticipation that down the road we would have more
  3. loop through all the locations and get all the inventory levels in the locations using the inventory level rest API
    1. I do this because inventory levels has the location ID per item, according to the Shopify rest API documentation.
  4. Loop through all of the inventory level items Anne look up the item ID in the dictionary I created so I can get the SKU.

The end result should be a list of objects each object containing the internal item ID, the SKU, and location. Unfortunately what I found was not everything matching and this is what has confused me. I wonder if anybody else has had this issue and if there is any Shopify developers around is there possibly a different way to do this so when there is an inventory change in our back end system I can take a valid item ID and use it to update in Shopify. Of course the best solution would be a rest API that allowed me to just enter and SKU and get in return the item ID

I should add that this is an application that is being written in C sharp using obviously the rest API


Is it possible that when they loaded data into Shopify they didn't do a great job or is there a difference between the inventorylevel item ID versus a product ID and if that's the case how do we correlate those two