SKU specifications are necessary to be able to choose the SKU, that is, the variation of the product. Example: Color, Size, Voltage. The SKU Selector can be found in the search result or on the product page.
If you wish to implement color variation in your products, we recommend you do not use SKU specifications. Instead, see this tutorial about How to implement product color variation.
VTEX Admin says that if a new SKU Specification field is created, all the SKUs associated will be deactivated. However, if created, products will keep activated.
Data Model
Field | Description | Required | Type | Default |
---|---|---|---|---|
Id | ID of Specification. This ID is used to delete/update the specification | No | Integer | AutoIncrement |
SkuId | ID of SKU | Yes | Integer | - |
FieldId | Field ID | Yes | Integer | - |
FieldValueId | ID of FieldValue. Required only for FieldTypeId 5,6 | Yes | Integer | null |
Text | Value of specification. Only for FieldTypeId different from 5,6,7 | No | String | null |
Implementation
Create SKU Specification
To create a SKU specification, simply use the API below. Remember that you must have saved the ID of the field for which you want to create, and the FieldId
of the value created for the field.
POST
_10https://{{accountName}}.vtexcommercestable.com.br/api/catalog/pvt/stockkeepingunit/{{skuId}}/specification/
Body:
_10{_10 "FieldId": 13,_10 "FieldValueId": 101_10}
Header:
_10Accept: application/json_10Content-Type: application/json_10X-VTEX-API-AppToken: {{X-VTEX-API-AppToken}}_10X-VTEX-API-AppKey: {{X-VTEX-API-AppKey}}
Response:
_10Status: 200 OK
_10{_10 "Id": 1505,_10 "SkuId": 1234568387,_10 "FieldId": 193,_10 "FieldValueId": 360,_10 "Text": "Size 10"_10}
Remove an SKU Specification
To remove a specification from an SKU, use the Delete SKU specification API endpoint.
Remove all specifications of specific SKU
To remove all specifications of one SKU, use the Delete all SKU specifications endpoint