Version: 202201
Update Variant By SKU
PUT/openapi/2022-01/variants/sku/:sku
Update a product variant by its SKU.
Request
Path Parameters
sku stringrequired
- application/json
- Body
- Example
Body
compare_at_pricestring
Variant original price, used for comparison with the actual price, can be converted to float64, supports only two decimal places
pricestring
Variant actual price, can be converted to float64, supports only two decimal places, set to "0.00" if price needs to be empty
barcodestring
The barcode of the variant.
notestring
The note of the variant.
inventory_quantityint32
The inventory quantity of the variant.
weightstring
The weight of the variant.
weight_unitstring
The unit for the weight of the variant.
cost_pricestring
The cost price of the variant.
retail_pricestring
Suggested retail price
refuse_multi_resultstring
false: If sku matches multiple sub-items, update the matched sub-items normally. true: Rejects the update if the sku matches more than one subitem
{
"compare_at_price": "string",
"price": "string",
"barcode": "string",
"note": "string",
"inventory_quantity": 0,
"weight": "string",
"weight_unit": "string",
"cost_price": "string",
"retail_price": "string",
"refuse_multi_result": "string"
}
Responses
- 200
- 422
200
- application/json
- Schema
- Example
- Result
Schema
- Array [
- Array [
- ]
- ]
variants object[]
idstring
Example:
88e68830-4ef5-4125-bf7d-aef8047176b2product_idstring
Example:
a1a88be0-a1d4-47e4-a2f2-ba6e131cf447image_idstring
Example:
8ef098c5-5a08-44b4-b5fb-89214bb507dccreated_atstring
Example:
2024-04-17T02:15:18Zupdated_atstring
Example:
2024-04-17T02:15:18Ztitlestring
Example:
S-blue-Toption1string
Example:
Soption2string
Example:
blueoption3string
Example:
Timage object
srcstring
Example:
//cdn.shoplazza.com/ccf0794c594bad32a320eea0d6bfe40c.jpegwidthinteger
Default value:
0Example:
174heightinteger
Default value:
0Example:
180pathstring
Example:
ccf0794c594bad32a320eea0d6bfe40c.jpegaltstring
Example:
positioninteger
Default value:
0Example:
1compare_at_pricestring
Example:
12.10pricestring
Example:
10.10skustring
Example:
T-M-S-blue-T-A001004barcodestring
Example:
6929000212340notestring
Example:
nodeinventory_quantityinteger
Default value:
0Example:
16weightstring
Example:
1.10weight_unitstring
Example:
kgcost_pricestring
Example:
1.10wholesale_price object[]
pricestring
Example:
10.10min_quantityinteger
Default value:
0Example:
1retail_pricestring
Example:
0.00{
"variants": [
{
"id": "88e68830-4ef5-4125-bf7d-aef8047176b2",
"product_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
"image_id": "8ef098c5-5a08-44b4-b5fb-89214bb507dc",
"created_at": "2024-04-17T02:15:18Z",
"updated_at": "2024-04-17T02:15:18Z",
"title": "S-blue-T",
"option1": "S",
"option2": "blue",
"option3": "T",
"image": {
"src": "//cdn.shoplazza.com/ccf0794c594bad32a320eea0d6bfe40c.jpeg",
"width": 174,
"height": 180,
"path": "ccf0794c594bad32a320eea0d6bfe40c.jpeg",
"alt": ""
},
"position": 1,
"compare_at_price": "12.10",
"price": "10.10",
"sku": "T-M-S-blue-T-A001004",
"barcode": "6929000212340",
"note": "node",
"inventory_quantity": 16,
"weight": "1.10",
"weight_unit": "kg",
"cost_price": "1.10",
"wholesale_price": [
{
"price": "10.10",
"min_quantity": 1
}
],
"retail_price": "0.00"
}
]
}
{
"variants": [
{
"id": "88e68830-4ef5-4125-bf7d-aef8047176b2",
"product_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
"image_id": "8ef098c5-5a08-44b4-b5fb-89214bb507dc",
"created_at": "2024-04-17T02:15:18Z",
"updated_at": "2024-04-17T02:15:18Z",
"title": "S-blue-T",
"option1": "S",
"option2": "blue",
"option3": "T",
"image": {
"src": "//cdn.shoplazza.com/ccf0794c594bad32a320eea0d6bfe40c.jpeg",
"width": 174,
"height": 180,
"path": "ccf0794c594bad32a320eea0d6bfe40c.jpeg",
"alt": ""
},
"position": 1,
"compare_at_price": "12.10",
"price": "10.10",
"sku": "T-M-S-blue-T-A001004",
"barcode": "6929000212340",
"note": "node",
"inventory_quantity": 16,
"weight": "1.10",
"weight_unit": "kg",
"cost_price": "1.10",
"wholesale_price": [
{
"price": "10.10",
"min_quantity": 1
}
],
"retail_price": "0.00"
}
]
}
422
- application/json
- Schema
- Example
- Result
Schema
- oneOf
- object
- object
errorsstring[]
{
"errors": [
"compare_at_price must be 0 or greater"
]
}
{ "errors": ["Record not found"] }