版本:202506
创建子款式
POST/openapi/2025-06/products/:product_id/variants
根据提供的信息创建一个新的子款式。
请求
Path参数
product_id string必填
子款式所属的商品 ID
- application/json
- 请求体
- 示例
请求体必填
- Array [
- ]
variant object必填
待创建的子款式数据
option1string
商品款式属性 1 的取值(例如"颜色"取值"红色")
option2string
商品款式属性 2 的取值
option3string
商品款式属性 3 的取值
image_idstring
子款式关联的图片 ID
compare_at_pricedouble
划线价
pricedouble必填
子款式售价;当子款式售价为 0 且批发价不为 0 时,将被自动设置为该商品的批发价
skustring
SKU
barcodestring
条形码
notestring
款式备注
inventory_quantityint64
库存数量
weightdouble
重量
weight_unitstring
重量单位,可选值:kg、g、lb、oz
cost_pricedouble
成本价
wholesale_price object[]
批发价列表
pricedouble必填
批发价
min_quantityint64必填
起购量(达到该数量才适用此批发价)
retail_pricedouble
零售价
positionint64必填
子款式在列表中的排序位置
extend object
子款式扩展信息(包裹尺寸、原产地国别、HS 代码等)
lengthdouble
包裹长度
widthdouble
包裹宽度
heightdouble
包裹高度
dimension_unitstring
尺寸单位,可选值:cm、in、mm
origin_country_codestring
原产地国别(国家代码,例如 CN、US)
hs_codestring
HS(协调制度)代码
{
"variant": {
"option1": "string",
"option2": "string",
"option3": "string",
"image_id": "string",
"compare_at_price": 0,
"price": 0,
"sku": "string",
"barcode": "string",
"note": "string",
"inventory_quantity": 0,
"weight": 0,
"weight_unit": "string",
"cost_price": 0,
"wholesale_price": [
{
"price": 0,
"min_quantity": 0
}
],
"retail_price": 0,
"position": 0,
"extend": {
"length": 0,
"width": 0,
"height": 0,
"dimension_unit": "string",
"origin_country_code": "string",
"hs_code": "string"
}
}
}
响应
- 200
OK
- application/json
- 数据结构
- 示例
数据结构
- Array [
- ]
codestring
错误码
messagestring
错误信息
data object
variant object
已创建的子款式
idstring
子款式 ID
product_idstring
子款式所属商品的 ID
image_idstring
子款式关联的图片 ID
created_atstring
子款式创建时间
updated_atstring
子款式最后更新时间
titlestring
子款式标题
option1string
子款式在第 1 个商品款式属性上的取值
option2string
子款式在第 2 个商品款式属性上的取值
option3string
子款式在第 3 个商品款式属性上的取值
image object
子款式图片
srcstring
图片 URL
widthint32
图片宽度(单位:像素)
heightint32
图片高度(单位:像素)
altstring
图片替代文本(alt)
pathstring
图片存储路径
positionint64
子款式在商品中的排序位置
compare_at_pricedouble
划线价
pricedouble
子款式售价
skustring
SKU
barcodestring
条形码
notestring
款式备注
inventory_quantityint64
库存数量
weightdouble
重量
weight_unitstring
重量单位,可选值:kg、g、lb、oz
cost_pricedouble
成本价
whole_prices object[]
批发价列表
pricedouble必填
批发价
min_quantityint64必填
起购量(达到该数量才适用此批发价)
retail_pricedouble
零售价
is_discountboolean
子款式当前是否处于打折状态
origin_pricedouble
原价
extend object
子款式扩展信息(包裹尺寸、原产地国别、HS 代码等)
lengthdouble
包裹长度
widthdouble
包裹宽度
heightdouble
包裹高度
dimension_unitstring
尺寸单位,可选值:cm、in、mm
origin_country_codestring
原产地国别(国家代码,例如 CN、US)
hs_codestring
HS(协调制度)代码
{
"code": "string",
"message": "string",
"data": {
"variant": {
"id": "string",
"product_id": "string",
"image_id": "string",
"created_at": "string",
"updated_at": "string",
"title": "string",
"option1": "string",
"option2": "string",
"option3": "string",
"image": {
"src": "string",
"width": 0,
"height": 0,
"alt": "string",
"path": "string"
},
"position": 0,
"compare_at_price": 0,
"price": 0,
"sku": "string",
"barcode": "string",
"note": "string",
"inventory_quantity": 0,
"weight": 0,
"weight_unit": "string",
"cost_price": 0,
"whole_prices": [
{
"price": 0,
"min_quantity": 0
}
],
"retail_price": 0,
"is_discount": true,
"origin_price": 0,
"extend": {
"length": 0,
"width": 0,
"height": 0,
"dimension_unit": "string",
"origin_country_code": "string",
"hs_code": "string"
}
}
}
}