catalog.product.setVariants
Wholesale-replace a product's variant STRUCTURE (order = array order). Existing variants update title/sku only; initial price/stock allowed solely for new variants.
- scope:
catalog:write - storefront-visible (bumps the catalog generation): yes
- destructive: no
Payload
| field | type | required | notes |
|---|---|---|---|
productId | string (/^prd_[a-zA-Z0-9]{1,32}$/) | yes | |
variants | array<object> (≤100) | yes |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"productId": {
"type": "string",
"pattern": "^prd_[a-zA-Z0-9]{1,32}$"
},
"variants": {
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^var_[a-zA-Z0-9]{1,32}$"
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"sku": {
"type": "string",
"minLength": 1,
"maxLength": 48
},
"price": {
"type": "integer",
"minimum": 0,
"maximum": 10000000000000
},
"stock": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "null"
}
]
}
},
"required": [
"title"
],
"additionalProperties": false
}
}
},
"required": [
"productId",
"variants"
],
"additionalProperties": false
}Generated from the live platform registries at build time — reference pages cannot go stale. Markdown variant: /reference/commands/catalog.product.setVariants.md