deleteProductVariant
Requires permission products:product:delete.
Deletes a variant. The last remaining variant of a product cannot be deleted. Requires permission to delete 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:
- GraphQL
- cURL
mutation DeleteProductVariant($id: ID!) {
deleteProductVariant(id: $id) {
id
QRCode
name
createdAt
attributes
barcode
baseUOM {
id
code
colorCode
name
pluralName
createdAt
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation DeleteProductVariant($id: ID!) {\n deleteProductVariant(id: $id) {\n id\n QRCode\n name\n createdAt\n attributes\n barcode\n baseUOM {\n id\n code\n colorCode\n name\n pluralName\n createdAt\n }\n }\n}",
"variables": {
"id": "id"
}
}
EOF
Variables:
{
"id": "id"
}
Response:
{
"data": {
"deleteProductVariant": {
"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"
}
}
}
}
deleteProductVariant(
id: ID!
): ProductVariant!
Arguments
deleteProductVariant.id ● ID! non-null scalar
The ID of the variant.
Type
ProductVariant object
A sellable version of a product, with its own SKU, price, units of measure and stock.