Update Variant

Update an existing product variant with the provided details.

🔒

Requires write_product access scope. More access scope

📘

Important Note: When updating the same product, the updateVariant API may encounter performance issues due to locking mechanisms. If multiple updates are needed for the same product (e.g., updating variant prices), it is strongly recommended to use the updateProduct API instead.

The Update Variant API allows users to modify the details of a specific product variant. By providing a valid variant_id in the path parameter, users can update fields such as options, pricing, inventory, and more. This endpoint is essential for managing product variants efficiently, ensuring the most accurate and updated information is reflected in the system.This API is especially useful for:

  1. Update variant-specific attributes like size, color, or SKU.
  2. Adjust pricing or inventory details for a particular variant.

Request Parameters

Public Request Parameters

📘

Path Parameters

ParameterTypeRequiredDescriptionExample
variant_idstringYesUnique identifier of the variant"var_123456789"

Body Parameters

ParameterTypeRequiredDescriptionExample
variantobjectYesVariant update data-
variant.option1stringNoFirst option value"Black"
variant.option2stringNoSecond option value"Large"
variant.option3stringNoThird option value""
variant.image_idstringNoAssociated image ID"img_456789"
variant.imageobjectNoVariant image details-
variant.image.srcstringYesImage URL"https://example.com/image.jpg"
variant.image.widthint32NoImage width800
variant.image.heightint32NoImage height600
variant.image.altstringNoAlt text"Black variant"
variant.image.pathstringNoStorage path"/images/variants"
variant.compare_at_pricedoubleNoOriginal price199.99
variant.pricedoubleYesSelling price149.99
variant.skustringNoStock keeping unit"SKU123-BLK-L"
variant.barcodestringNoProduct barcode"123456789012"
variant.notestringNoInternal notes"New stock"
variant. inventory_quantitystringNoStock quantity"50"
variant.weightdoubleNoProduct weight0.75
variant.weight_unitstringNoWeight unit"kg"
variant.cost_pricedoubleNoCost price89.99
variant.whole_pricesarray of objectsNoWholesale pricing-
variant.whole_prices. pricefloatNoWholesale price129.99
variant.whole_prices. min_quantitystringNoMinimum order"10"
variant.retail_pricedoubleNoRetail price149.99
variant.positionstringNoDisplay position"2"
variant.extendobjectNoExtended properties-
variant.extend.lengthdoubleNoProduct length25.5
variant.extend.widthdoubleNoProduct width18.0
variant.extend.heightdoubleNoProduct height8.5
variant.extend. dimension_unitstringNoDimension unit"cm"
variant.extend. origin_country_codestringNoCountry of origin"CN"
variant.extend.hs_codestringNoHS classification code"8518.29.00"

Response Explanation

Public Response Parameters

📘

Successful Response

ParameterTypeExampleDescription
codestring"200"HTTP status code
messagestring"Success"Operation result message
data.variantarray of objects-

Variant Object

ParameterTypeExampleDescription
idstring"var_987654321"Unique variant identifier
product_idstring"prod_123456789"Parent product ID
image_idstring"img_456789"Primary image reference
created_atstring"2025-01-15T09:00:00Z"Creation timestamp
updated_atstring"2025-06-15T14:30:00Z"Last update timestamp
titlestring"Large / Black"Variant display title
option1string"Black"First option value
option2string"Large"Second option value
option3string""Third option value
imageobject-Variant image details
image.srcstring"https://example. com/image.jpg"Image URL
image.widthint32800Image width in pixels
image.heightint32600Image height in pixels
image.altstring"Black variant"Image alt text
image.pathstring"/images/variants"Image storage path
positionstring"1"Display position
compare_at_pricefloat199.99Original/comparison price
pricefloat149.99Current selling price
skustring"SKU123-BLK-L"Stock keeping unit
barcodestring"123456789012"Product barcode
notestring"New stock"Internal notes
inventory_quantitystring"50"Current stock level
weightfloat0.75Product weight
weight_unitstring"kg"Weight measurement unit
cost_pricefloat89.99Cost/production price
whole_pricesarray of objects-Wholesale pricing tiers
whole_prices.pricefloat129.99Wholesale price
whole_prices. min_quantitystring"10"Minimum order quantity
retail_pricefloat149.99Retail price
is_discountbooleantrueDiscount status flag
origin_pricefloat179.99Original base price
extendobject-Extended properties
extend.lengthfloat25.5Product length
extend.widthfloat18.0Product width
extend.heightfloat8.5Product height
extend. dimension_unitstring"cm"Dimension unit
extend. origin_country_codestring"CN"Country of origin
extend.hs_codestring"8518.29.00"Harmonized System code

Error Response

FieldTypeExampleDescription
codestringInvalidParameterError http message
messagestring``Error message
Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!