Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

availableQuantity does not update quantity

Solved

availableQuantity does not update quantity

Mugenni
Visitor
2 1 0

I am trying to update product variants inventory stock through productUpdate via:

"mutation ($input: ProductInput!) { productUpdate (input: $input) { product { id } } }"

where input is:

{"title"=>"product", "vendor"=>"pr", :options=>"Produkt",
:variants=>[{"price"=>"11.00",
             :compareAtPrice=>nil,
             "sku"=>"1111", 
             :options=>"*** ***",
             "barcode"=>"1111", 
             :inventoryPolicy=>"CONTINUE", 
             :inventoryItem=>{:cost=>"6.49", :tracked=>true},
             :inventoryQuantities=>{:availableQuantity=>85, 
                                    :locationId=>"gid://shopify/Location/60120137888"}}],
 :id=>"gid://shopify/Product/6622178770997"}

And as result, in the admin panel, I receive available quantity  -41 

How it is possible to send 85 and get -41 ?

Everything else updates right. 

Accepted Solution (1)

Mugenni
Visitor
2 1 0

This is an accepted solution.

Sovled. It was the wrong location id. Still, a mystery why quantity became minus value with a wrong location id, and there were no errors.

View solution in original post

Reply 1 (1)

Mugenni
Visitor
2 1 0

This is an accepted solution.

Sovled. It was the wrong location id. Still, a mystery why quantity became minus value with a wrong location id, and there were no errors.