Skip to main content

updateProductVariant

Requires permission products:product:update.

Updates a variant. Changing the SKU to one already in use is refused. Changing opening stock, opening stock cost or cost needs the permission to adjust stock. Requires permission to update products.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation UpdateProductVariant($id: ID!, $updateProductVariantInput: UpdateProductVariantInput!) {
updateProductVariant(
id: $id
updateProductVariantInput: $updateProductVariantInput
) {
id
QRCode
name
createdAt
attributes
barcode
baseUOM {
id
code
colorCode
name
pluralName
createdAt
}
}
}

Variables:

{
"id": "id",
"updateProductVariantInput": {}
}

Response:

{
"data": {
"updateProductVariant": {
"id": "id",
"QRCode": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"attributes": {},
"barcode": "string",
"baseUOM": {
"id": "id",
"code": "string",
"colorCode": "string",
"name": "string",
"pluralName": "string",
"createdAt": "2025-01-15T00:00:00Z"
}
}
}
}
updateProductVariant(
id: ID!
updateProductVariantInput: UpdateProductVariantInput!
): ProductVariant!

Arguments​

updateProductVariant.id ● ID! non-null scalar​

The ID of the variant.

updateProductVariant.updateProductVariantInput ● UpdateProductVariantInput! non-null input​

The fields to change on the variant.

Type​

ProductVariant object​

A sellable version of a product, with its own SKU, price, units of measure and stock.