Skip to content

Update a variant

View as Markdown
patch /api/products/{productId}/variants/{variantId}

Updates the Product Variant resource.

Partially updates a variant. The body is a JSON Merge Patch document: any field you include replaces the current value, and any field you omit is left untouched.

Path parameters

NameTypeRequiredDescription
productIdstringrequiredProductResource identifier
variantIdstringrequiredProduct Variant identifier

Request body

PropertyTypeRequiredDescription
barcodestring-The barcode, unique UPC, or ISBN number for the product.
measurementEmbeddedMeasurementResource | null-The measurement used to compute per-unit prices for the variant.
Show measurement fields
PropertyTypeRequiredDescription
measuredType"volume" | "weight" | "length" | "area" | "unit"requiredThe kind of physical quantity measured (volume, weight, length, area or unit).
quantityUnit"ml" | "cl" | "l" | "mg" | "g" | "kg" | "mm" | "cm" | "m" | "m2" | "unit"requiredThe unit the variant's quantity is expressed in.
quantityValueintegerrequiredThe variant's quantity, expressed in the quantity unit.
referenceUnit"ml" | "cl" | "l" | "mg" | "g" | "kg" | "mm" | "cm" | "m" | "m2" | "unit"requiredThe unit used as the basis for per-unit price calculations.
referenceValueintegerrequiredThe number of reference units used for per-unit price calculations.
mediasstring[]-A list of Media, ordered by position. Only media of type "image" can be associated with a variant. Returned as IRI strings by default; pass ?expand=medias to embed full Media objects. Requires the medias:read scope. Returned empty when the scope is missing.
optionValuesstring[]-A list of Option Value, each one representing an option value associated with the variant. Requires the products:read scope. Returned empty when the scope is missing.
skustring-A unique identifier for the product variant.

Response

200 - Product Variant resource updated

PropertyTypeRequiredDescription
@contextstring | object-
@idstringrequired
@typestringrequired
barcodestringrequiredThe barcode, unique UPC, or ISBN number for the product.
createdAtstring-The date and time when the resource was created (ISO 8601 format).
idstring-The resource's unique identifier (UUID).
measurementEmbeddedMeasurementResource | null-The measurement used to compute per-unit prices for the variant.
Show measurement fields
PropertyTypeRequiredDescription
measuredType"volume" | "weight" | "length" | "area" | "unit"requiredThe kind of physical quantity measured (volume, weight, length, area or unit).
quantityUnit"ml" | "cl" | "l" | "mg" | "g" | "kg" | "mm" | "cm" | "m" | "m2" | "unit"requiredThe unit the variant's quantity is expressed in.
quantityValueintegerrequiredThe variant's quantity, expressed in the quantity unit.
referenceUnit"ml" | "cl" | "l" | "mg" | "g" | "kg" | "mm" | "cm" | "m" | "m2" | "unit"requiredThe unit used as the basis for per-unit price calculations.
referenceValueintegerrequiredThe number of reference units used for per-unit price calculations.
mediasarray-A list of Media, ordered by position. Only media of type "image" can be associated with a variant. Returned as IRI strings by default; pass ?expand=medias to embed full Media objects. Requires the medias:read scope. Returned empty when the scope is missing.
metafieldsarray-Metafields owned by this variant. Serialized as IRI strings by default; pass ?expand=metafields to embed full MetafieldResource objects. Requires the metafields:read scope. Returned empty when the scope is missing.
optionValuesarray-A list of Option Value, each one representing an option value associated with the variant. Requires the products:read scope. Returned empty when the scope is missing.
productstring | Product | nullrequiredThe product resource it belongs to. Requires the products:read scope. Returned null when the scope is missing.
resolvedPriceResolvedPriceResource | null-The price resolved for the current resolveContext (country, channel and instant). Null unless resolveContext[country], resolveContext[channel] and resolveContext[at] are all provided.
Show resolvedPrice fields
PropertyTypeRequiredDescription
atstring-The instant used to resolve the price (defaults to request time).
channelIdstring-The Channel used to resolve the price.
countryIdstring-The Country used to resolve the price.
currencystring-ISO 4217 currency code (mirrors price.currency for convenience).
discountPriceEmbeddedMoneyResource | null-The discount price including tax, if any.
Show discountPrice fields
PropertyTypeRequiredDescription
amountstringrequiredThe monetary amount, as a decimal string.
currencystringrequiredThe ISO 4217 currency code (e.g. EUR).
discountTaxExcludedPriceEmbeddedMoneyResource | null-The discount price excluding tax, if any.
Show discountTaxExcludedPrice fields
PropertyTypeRequiredDescription
amountstringrequiredThe monetary amount, as a decimal string.
currencystringrequiredThe ISO 4217 currency code (e.g. EUR).
lowestPriceLast30DaysEmbeddedMoneyResource | null-Lowest price including tax observed on the rolling window [at - 30 days, at] for the same (variant, channel, country). Falls back to the current price when no prior data exists.
Show lowestPriceLast30Days fields
PropertyTypeRequiredDescription
amountstringrequiredThe monetary amount, as a decimal string.
currencystringrequiredThe ISO 4217 currency code (e.g. EUR).
lowestPriceLast30DaysAtstring | null-The instant at which lowestPriceLast30Days was active. Falls back to at when no prior data exists.
priceEmbeddedMoneyResource-The price including tax.
Show price fields
PropertyTypeRequiredDescription
amountstringrequiredThe monetary amount, as a decimal string.
currencystringrequiredThe ISO 4217 currency code (e.g. EUR).
saleOfferIdstring-The SaleOffer that was resolved.
taxExcludedPriceEmbeddedMoneyResource-The price excluding tax.
Show taxExcludedPrice fields
PropertyTypeRequiredDescription
amountstringrequiredThe monetary amount, as a decimal string.
currencystringrequiredThe ISO 4217 currency code (e.g. EUR).
taxRatenumber-Tax rate applied, in percent (e.g. 20.0).
skustringrequiredA unique identifier for the product variant.
updatedAtstring-The date and time when the resource was last modified (ISO 8601 format).

Errors

400 - Invalid input

PropertyTypeRequiredDescription
@contextstring | object-
@idstringrequired
@typestringrequired
codestring-Stable identifier of the error in the error code catalogue (see /api/error-codes). Present on catalogued errors only.
descriptionstring | null-
detailstring | null-A human-readable explanation specific to this occurrence of the problem.
instancestring | null-A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
messagestring-End-user message localized in the request locale, with this occurrence's values substituted. Present on catalogued errors only.
slugstring-Stable, readable key of the error in the error code catalogue. Present on catalogued errors only.
statusinteger | null-
titlestring | null-A short, human-readable summary of the problem. For a catalogued error it repeats the slug.
typestring-A URI reference that identifies the problem type. For a catalogued error it is the error code resource, /api/error-codes/{code}.

403 - Access denied. The caller is missing one or more permissions required for this operation.

Content-Type: application/problem+json

PropertyTypeRequiredDescription
@contextstring | object-
@idstringrequired
@typestringrequired
detailstring-
missingPermissionsstring[]-Permissions that the caller is missing for this operation. Present only when the 403 is caused by a denied permission.
statusinteger-
titlestring-
typestring-

404 - Not found

PropertyTypeRequiredDescription
@contextstring | object-
@idstringrequired
@typestringrequired
codestring-Stable identifier of the error in the error code catalogue (see /api/error-codes). Present on catalogued errors only.
descriptionstring | null-
detailstring | null-A human-readable explanation specific to this occurrence of the problem.
instancestring | null-A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
messagestring-End-user message localized in the request locale, with this occurrence's values substituted. Present on catalogued errors only.
slugstring-Stable, readable key of the error in the error code catalogue. Present on catalogued errors only.
statusinteger | null-
titlestring | null-A short, human-readable summary of the problem. For a catalogued error it repeats the slug.
typestring-A URI reference that identifies the problem type. For a catalogued error it is the error code resource, /api/error-codes/{code}.

422 - An error occurred

PropertyTypeRequiredDescription
@contextstring | object-
@idstringrequired
@typestringrequired
descriptionstring-
detailstring-
instancestring | null-
statusinteger-
titlestring | null-
typestring-
violationsobject[]-
Show violations fields
PropertyTypeRequiredDescription
codestring-The code of the violation
hintstring-An extra hint to understand the violation
messagestringrequiredThe message associated with the violation
parametersobject-Dynamic placeholder values for the violation message template (substitute into the code catalogue message).
payloadobject-The serialized payload of the violation
propertyPathstringrequiredThe property path of the violation
slugstring-Stable centralized error-code slug for this violation (see /api/error-codes).