Product update API not updating inventory quantity!

tnakhleh
Visitor
2 0 1

Hi Everybody

We are using REST admin Product APIs  (currently v 2022-04), I'm trying to update our product in Shopify for sync it with our inventory.. so we need to update price, descriptions, quantity..etc

The API work fine for all fields and we can update Price, descriptions and other fields except the quantity

( inventory quantity field)

 

as example: I send PUT request with the following payload : 

{
	"product": {
		"images": null,
		"id": "1122654",
		"title": " tshirt ",
		"vendor": "XX",
		"product_type": "clothing",
		"options": [
			{
				"name": "Color",
				"values": ["Grey"]
			},
			{
				"name": "Size",
				"values": [ "XS","S","M","L"]
			}
		],
		"variants": [
			{
				"inventory_quantity": "0",
				"option1": "Grey",
				"id": "123456789112345",
				"option2": "L",
				"price": "200.0",
				"compare_at_price": "250.0",
				"barcode": "0000123456789",
				"sku": "0000123456789",
				"inventory_policy": "deny",
				"inventory_management": "shopify"
			},
			{
				"inventory_quantity": "1",
				"option1": "Grey",
				"id": "123456789112346",
				"option2": "S",
				"price": "200.0",
				"compare_at_price": "250.0",
				"barcode": "0000123456788",
				"sku": "0000123456788",
				"inventory_policy": "deny",
				"inventory_management": "shopify"
			}
		],
		"published_at": "",
		"body_html": " DEscription",
		"tags": "clothing, men"
	}
}

All felds updateed, except the inventory_quantity remain the same as on the Shopify , the example JSON try to update the first variant with quantity 0, and the second with the value 1. 

Is there any thing missing here.

 

Thanks in advance.

 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1358 225 475

Hey @tnakhleh,

 

Thanks for your post.

 

As per the ProductVariant dev docs, can no longer set inventory using inventory_quantity or inventory_quantity_adjustment. For more information, refer to the Inventory Level resource.

 

Hope that helps! 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog