Product Services:UpdateAsync - (400 Bad Request) Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported.
See original GitHub issueLoading the product using GetAsync, Product product = await productService.GetAsync((long)apiCall.Product.Id); product.Tags = newTags; product = await productService.UpdateAsync((long)product.Id, product);
calling the UpdateAsync gives below error, (400 Bad Request) Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API.
Stack trace:
at ShopifySharp.ShopifyService.CheckResponseExceptions(HttpResponseMessage response, String rawResponse) at ShopifySharp.ShopifyService.<>c__DisplayClass26_0
1.<<ExecuteRequestAsync>b__0>d.MoveNext()
— End of stack trace from previous location where exception was thrown —
at ShopifySharp.DefaultRequestExecutionPolicy.Run[T](CloneableRequestMessage request, ExecuteRequestAsync1 executeRequestAsync) at ShopifySharp.ShopifyService.ExecuteRequestAsync[T](RequestUri uri, HttpMethod method, HttpContent content, String rootElement) at ShopifySharp.ProductService.UpdateAsync(Int64 productId, Product product)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
@madushann It’s possible that it could mess up some product data, since many of the properties you don’t set would be serialized as
null
. That’s why @mark-jeanswhse is usingPublishedAt = ...
– if that one is accidentally set to null, it will unpublish your product.You should also be able to just set the
InventoryQuantity
property to null before you update the product, and that should get it working again.I’m going to publish an update to the
ProductService
that will automatically do this behind the scenes for each update call, as I’ve had a handful of questions and emails about this error. It’s too easy for us to accidentally shoot ourselves in the foot when trying to update products thanks to the property deprecation.@nozzlegear
Hope, Once you push the update will be available straight forward with newer version.