Development discussions around Shopify APIs
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 |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023