Version: 202201
Create Variant
POST/openapi/2022-01/products/:product_id/variants
Create a new product variant with the specified details.
Request
Path Parameters
product_id stringrequired
Product's ID
- application/json
- Body
- Example
Body
- Array [
- ]
variant object
option1string
The first style value of the variant
option2string
The second style value of the variant
option3string
The second style value of the variant
image_idstring
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
positionint32required
skustring
barcodestring
notestring
inventory_quantityint32
weightstring
weight_unitstring
Weight unit, supports kg, g, lb, oz
cost_pricestring
wholesale_price object[]
pricestring
min_quantityint32
Mini Order Quantity
{
"variant": {
"option1": "string",
"option2": "string",
"option3": "string",
"image_id": "string",
"compare_at_price": "string",
"price": "string",
"position": 0,
"sku": "string",
"barcode": "string",
"note": "string",
"inventory_quantity": 0,
"weight": "string",
"weight_unit": "string",
"cost_price": "string",
"wholesale_price": [
{
"price": "string",
"min_quantity": 0
}
]
}
}
Responses
- 200
- 404
- 422
200
- application/json
- Schema
- Example
- Result
Schema
- Array [
- ]
variant object
idstring
Example:
1b735278-62c7-41ad-9976-b1b63a90590dproduct_idstring
Example:
636a07da-39eb-4829-bde9-b65fae1c28b0image_idstring
Example:
91d032e7-bbc8-47e4-8668-9ba6fe714de6created_atstring
Example:
2024-04-15T02:00:57Zupdated_atstring
Example:
2024-04-15T02:00:57Ztitlestring
Example:
S-redoption1string
Example:
Soption2string
Example:
redoption3string
Example:
image object
srcstring
Example:
//cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.pngwidthinteger
Default value:
0Example:
1588heightinteger
Default value:
0Example:
2246pathstring
Example:
efd33b921cacd5311a32dd03a9bc8740.pngaltstring
Example:
positioninteger
Default value:
0Example:
1compare_at_pricestring
Example:
100.00pricestring
Example:
100.00skustring
Example:
S-REDbarcodestring
Example:
123notestring
Example:
s-redinventory_quantityinteger
Default value:
0Example:
10weightstring
Example:
0.10weight_unitstring
Example:
kgcost_pricestring
Example:
11.00wholesale_price object[]
pricestring
Example:
100.00min_quantityinteger
Default value:
0Example:
1extend
{
"variant": {
"id": "1b735278-62c7-41ad-9976-b1b63a90590d",
"product_id": "636a07da-39eb-4829-bde9-b65fae1c28b0",
"image_id": "91d032e7-bbc8-47e4-8668-9ba6fe714de6",
"created_at": "2024-04-15T02:00:57Z",
"updated_at": "2024-04-15T02:00:57Z",
"title": "S-red",
"option1": "S",
"option2": "red",
"option3": "",
"image": {
"src": "//cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png",
"width": 1588,
"height": 2246,
"path": "efd33b921cacd5311a32dd03a9bc8740.png",
"alt": ""
},
"position": 1,
"compare_at_price": "100.00",
"price": "100.00",
"sku": "S-RED",
"barcode": "123",
"note": "s-red",
"inventory_quantity": 10,
"weight": "0.10",
"weight_unit": "kg",
"cost_price": "11.00",
"wholesale_price": [
{
"price": "100.00",
"min_quantity": 1
}
],
"extend": {}
}
}
{
"variant": {
"id": "1b735278-62c7-41ad-9976-b1b63a90590d",
"product_id": "636a07da-39eb-4829-bde9-b65fae1c28b0",
"image_id": "91d032e7-bbc8-47e4-8668-9ba6fe714de6",
"created_at": "2024-04-15T02:00:57Z",
"updated_at": "2024-04-15T02:00:57Z",
"title": "S-red",
"option1": "S",
"option2": "red",
"option3": "",
"image": {
"src": "//cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png",
"width": 1588,
"height": 2246,
"path": "efd33b921cacd5311a32dd03a9bc8740.png",
"alt": ""
},
"position": 1,
"compare_at_price": "100.00",
"price": "100.00",
"sku": "S-RED",
"barcode": "123",
"note": "s-red",
"inventory_quantity": 10,
"weight": "0.10",
"weight_unit": "kg",
"cost_price": "11.00",
"wholesale_price": [
{
"price": "100.00",
"min_quantity": 1
}
],
"extend": null
}
}
404
- application/json
- Schema
- Example
- Result
Schema
errorsstring[]
{
"errors": [
"Product not found"
]
}
{
"errors": [
"Product not found"
]
}
422
- application/json
- Schema
- Example
- Result
Schema
errorsstring[]
{
"errors": [
"Price must be entered."
]
}
{
"errors": [
"Price must be entered."
]
}