Updating with productVariantUpdate with inventoryQuantities has no effect

Pab89
Tourist
5 1 0

Hi,

I am trying to update the quantity of a product variation, I read the docs and found inventoryQuantities which I also use when I am updating multiple variants through "productUpdate", but when I use it with productVariantUpdate for a single product it seems to have no effect. See the screenshot below where I send the mutation and in the response I get back there's still "10" in stock even though it should have updated it to 3. As I only have access to the variant SKU + locationID + the new stock level I need to find a way to update the inventory directly from the productVariant, which should be possible when looking in the docs, also it works with "productUpdate".

Skærmbillede 2020-10-14 kl. 12.04.39.png

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

In order to adjust on-hand quantities you need to use the adjustInventoryLevelQuantity mutation. As described here --> https://shopify.dev/tutorials/manage-product-inventory-with-admin-api

Below is a screen shot of a successful test run. Hope this helps!

Untitled.png

0 Likes
Pab89
Tourist
5 1 0

Thank you for the fast reply. Then I don't understand why I am getting no error from my call, if the values aren't allowed. Also it works with "ProductUpdate". The problem with the adjustInventoryLevelQuantity is that it requires that you know the "inventoryLevelId" in advance. I am developing an integration with a POS system and use their SKU's as the unique identifier between the two systems.

0 Likes
Greg_Kujawa
Shopify Partner
937 79 201

It is a bit inconsistent in how it's handled between products, variants, quantities, other attributes, etc. In your use case, you might have to make a couple of API calls. One would determine the inventory item ID for a particular SKU. Then you'd have to make an API call to adjust the quantity for that particular inventory item. Not the slickest solution, but it should work.

0 Likes
Pab89
Tourist
5 1 0

Thanks for the reply, I understand that is possible with this other call. But I still hope someone can direct me to make the original call work, as it's documented it should work in their API documentation and would greatly reduce the complexity in the integration, also as I have to update thousands of products I would take a very long time if I had to fetch the inventoryLevels ID each time, due to the rate limiting of shopify.

0 Likes