Update a variant
Variant names are set via option1/option2/option3. On update, stocks accepts available_units/total_units in addition to location_id.
PUT
/products/{product_id}/variants/{id}Authorization
AuthorizationBearer token (JWT) · headerrequiredPath parameters
product_idstringrequiredidstringrequiredVariant ID or SKU
Request body
requiredapplication/jsonskustringbarcode_numberstringoption1stringoption2stringoption3stringoption_valuesobjectCustom variant option values, keyed by `option1`/`option2`/`option3`.
option_asset_idsobjectAsset IDs to associate with each option value.
product_asset_idsinteger[]Product image asset IDs to associate with this variant.
colorstringregular_priceintegersale_priceintegercostintegerCost in cents (for margin reporting, not shown to buyers).
statusstringAllowed:
visiblehiddenavailable_if_no_stockbooleanweight_in_gramsintegerunit_quantitynumberonline_stockintegerstocksobject[]Show propertiesHide properties
Array of
objectlocation_idintegeravailable_unitsintegertotal_unitsintegerallows_negativebooleanResponses
200Variant updated
_linksHalLinksidintegerproduct_idintegernamestringDisplay name, computed from option1/option2/option3.
statusstringAllowed:
visiblehiddenskustringbarcode_numberstringoption1stringoption2stringoption3stringcurrency_codestringregular_priceintegerRegular price in cents
sale_priceinteger | nullSale price in cents
priceintegerEffective price in cents (sale_price if set, else regular_price)
online_stockintegerall_stockintegeravailable_if_no_stockbooleanweight_in_gramsintegerunit_quantitynumbercolorstringcostintegerprofitintegerstocksobject[]Per-location stock breakdown
Show propertiesHide properties
Array of
objectlocation_idintegeravailable_unitsintegertotal_unitsintegerRequest
curl -X PUT "https://api.onbolder.com/v2/products/string/variants/string" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"regular_price": 7999
}'const response = await fetch("https://api.onbolder.com/v2/products/string/variants/string", {
method: "PUT",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"regular_price": 7999
})
});import requests
response = requests.put(
"https://api.onbolder.com/v2/products/string/variants/string",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"regular_price": 7999
},
)Response
{
"_links": {
"property1": {
"href": "string",
"templated": true,
"method": "get",
"title": "string",
"type": "string"
},
"property2": {
"href": "string",
"templated": true,
"method": "get",
"title": "string",
"type": "string"
}
},
"id": 0,
"product_id": 0,
"name": "string",
"status": "visible",
"sku": "string",
"barcode_number": "string",
"option1": "string",
"option2": "string",
"option3": "string",
"currency_code": "string",
"regular_price": 0,
"sale_price": 0,
"price": 0,
"online_stock": 0,
"all_stock": 0,
"available_if_no_stock": true,
"weight_in_grams": 0,
"unit_quantity": 0,
"color": "string",
"cost": 0,
"profit": 0,
"stocks": [
{
"location_id": 0,
"available_units": 0,
"total_units": 0
}
]
}