What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

productVariantUpdate bug on inventoryQuantities

productVariantUpdate bug on inventoryQuantities

alex0000
Shopify Partner
10 0 2

Hello, 

 

I see the the admin api admin/api/2022-01/graphql.json have a bug on update variant available quantity

here is my variable from this functions https://shopify.dev/api/admin-graphql/2022-01/mutations/productVariantUpdate

{
"input":{
    "id": "gid://shopify/ProductVariant/41558436053173",
    "price": 89,
    "inventoryQuantities": [{
      "availableQuantity": 7,
      "locationId": "gid://shopify/Location/65994916021"
    }]
}
}

quantity doesn't update (and i need to update quantity ^^")

so here is the bug is there an other way to do it before the bug will be patched ? 

sincerely
 

Replies 3 (3)

SB_90
Shopify Partner
216 52 70

Hi @alex0000 

 

If you're trying to update an existing product then you need to use a different call.

 

As per the documentation, inventoryQuantities can only be used when creating a variant - not when updating a variant that already exists:

 

Create only field. The inventory quantities at each location where the variant is stocked.

I think you may be looking for the inventoryAdjustQuantity mutation instead?

 

https://shopify.dev/api/admin-graphql/2022-01/mutations/inventoryAdjustQuantity

 

alex0000
Shopify Partner
10 0 2

Thank you for your quick response 🙂
i look to set inventory level to a specific quantity, not a delta

 

but if it's a create only field why this field is  present in productVariantUpdate method ? 
documentation is not clear, this field should be only in productVariantCreate method.

Mads_W
Excursionist
16 2 14

Totally agree Alex. Seems strange. 

With REST api you can set value, but not with GraphQL, where we're only able to set deltas. Would like to being able to set quantity without the extra get current quantity first.