A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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
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
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.
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.