Skip to main content

Create a Variant

OAuthScope

ZohoCommerce.items.CREATE

 

HTTP Request

POST  https://commerce.zoho.com/store/api/v1/variants

 

Body Parameters

ParameterDescription
product_idstring: Give product id of the product to which variant need to be added.
ratestring: Give selling price of the variant
initial_stock string: Give stock count for the variant. This field is MANDATORY if you pass variant_type as "inventory".
attribute_option_name1, attribute_option_name2, attribute_option_name3*string: Give attribute values for the corresponding attributes. For eg: If attribute_name1 is SIZE then give attribute_option_name1 (eg: large,medium,..etc) with the corresponding values.
attribute_option_data1, attribute_option_data2, attribute_option_data3*string: Give color code for the correspoding attributes. This field is only needed when you give attribute_type as colour.For Eg: If attribute_type2 is Colour then give corresponding color code value in attribute_option_data2
label_ratestring: Give retail price of the variant.
document_idsarray: Give set of document_id of the iamges to map with variants.
skustring: Give SKU for the variant.
custom_fieldsarray: Give set of custom_field values for the variant
customfield_idlong: Give unique cusomfield id to denote the label.
valuestring: Give corresponding values for the label.
reorder_levelstring: Low stock limit for the variant below which will trigger an email remainder.
package_detailsarray: Give package details such as weight, width, height and length. This is used to calculate shipping charges at the time of checkout.
heightstring: Give the package height.
weightstring: Give the package weight.
lengthstring: Give the package length
widthstring: Give the package width.
eanstring: Give EAN for the variant.
upcstring: Give UPC for the variant.
isbnstring: Give ISBN for the variant.
part_numberstring: Give MPN for the variant.
hsn_or_sacstring: Give HSN or SAC for the variant. For India only.
avatax_tax_codestring: Give Avalara tax code for the variant. For US only.

 

Sample Request

Copiedcurl -i -X POST \
-H "Authorization:Zoho-oauthtoken ***" \
-H "X-com-zoho-store-organizationid:682219181" \
-H "Content-Type:application/json" \
-d \
'{"attribute_option_name1":"XL","rate":"1600","label_rate":"2100","initial_stock":"30","reorder_level":"5","sku":"W005-51-121","product_id":"170670700000
'https://commerce.zoho.com/store/api/v1/variants
Copied{
"code": 0,
"message": "Variant created successfully",
"variant": {
"product_id": "1706707000000561016",
"product_name": "A-line Pink Dress",
"variant_id": "1706707000000562040",
"name": "A-line Pink Dress-XL",
"unit": "",
"is_taxable": true,
"tax_id": "",
"documents": [
],
"description": "",
"tax_name": "",
"tax_percentage": 0,
"tax_type": "",
"product_type": "goods",
"purchase_account_id": "1706707000000034003",
"purchase_account_name": "Cost of Goods Sold",
"account_id": "1706707000000000388",
"account_name": "Sales",
"inventory_account_id": "1706707000000034001",
"inventory_account_name": "Inventory Asset",
"tags": [
],
"tax_exemption_id": "",
"tax_exemption_code": "",
"attribute_id1": "1706707000000067329",
"attribute_id2": "",
"attribute_id3": "",
"attribute_name1": "Size",
"attribute_name2": "",
"attribute_name3": "",
"attribute_type1": "Text",
"attribute_type2": "",
"attribute_type3": "",
"status": "active",
"source": "api",
"is_combo_product": false,
"variant_type": "inventory",
"rate": 1600,
"label_rate": 2100,
"pricebook_rate": 1600,
"purchase_rate": 0,
"reorder_level": 5,
"initial_stock": 30,
"initial_stock_rate": 1600,
"package_details": {
"length": "",
"width": "",
"height": "",
"weight": "",
"weight_unit": "lb",
"dimension_unit": "in"
},
"vendor_id": "",
"vendor_name": "",
"stock_on_hand": 30,
"asset_value": "",
"available_stock": 30,
"actual_available_stock": 30,
"available_sale_stock": 30,
"sku": "W005-51-121",
"upc": "",
"ean": "",
"isbn": "",
"part_number": "",
"attribute_option_id1": "1706707000000067343",
"attribute_option_id2": "",
"attribute_option_id3": "",
"attribute_option_name1": "XL",
"attribute_option_name2": "",
"attribute_option_name3": "",
"attribute_option_data1": "",
"attribute_option_data2": "",
"attribute_option_data3": "",
"image_name": "",
"custom_fields": [
],
"custom_field_hash": {
},
"purchase_description": "",
"image_type": "",
"sales_channels": [
]
}
}

Show full

Show less

Use this API to create a variant for the product.