Development discussions around Shopify APIs
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
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".
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!
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.
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.
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.
User | RANK |
---|---|
5 | |
5 | |
4 | |
4 | |
4 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022