Update Product Variant
PUT {{baseUrl}}/products/variants/:variant?sku=<string>&barcode=<string>&price=<number>&sale_price=<number>&cost_price=<string>&stock_quantity=<string>
This endpoint allows you to update variant details by providing the ID of the variant you want to update its details in the variant path parameter.
💡Note
All variables in the update variant body request are optional. Updating one variable at a time is possible, but at least one of the variables must be in the body request payload. Otherwise, an error will be shown if you send an empty body request payload.
Scope: products.read_write
- Products Read & Write
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
sku | string | The sku value of product variant. Example: 23-TD23-32 | |
barcode | string | The barcode value of product variant. Example: abc01 | |
price | string | The price of the product variant. Example: 96.33 | |
sale_price | string | The sale price of the product variant. Example: 90.50 | |
cost_price | string | The cost price of the product variant. Example: 100.33 | |
stock_quantity | string | Amount of the product variant total stock quantity. Only updated if the store feature manage product by branches is not activated. Example: 4 |
Request Body
{"sku"=>"<string>", "barcode"=>"<string>", "price"=>"<number>", "sale_price"=>"<number>", "cost_price"=>"<number>", "stock_quantity"=>"<number>", "weight"=>"<number>", "mpn"=>"<number>", "gtin"=>"<number>", "notify_low"=>"<integer>"}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string | ||
Accept | string |
RESPONSES
status: Created
{"status":"\u003cnumber\u003e","success":"\u003cboolean\u003e","data":{"id":"\u003cnumber\u003e","price":{"amount":"\u003cnumber\u003e","currency":"\u003cstring\u003e"},"regular_price":{"amount":"\u003cnumber\u003e","currency":"\u003cstring\u003e"},"cost_price":{"amount":"\u003cnumber\u003e","currency":"\u003cstring\u003e"},"sale_price":{"amount":"\u003cnumber\u003e","currency":"\u003cstring\u003e"},"has_special_price":"\u003cboolean\u003e","stock_quantity":"\u003cinteger\u003e","unlimited_quantity":"\u003cboolean\u003e","notify_low":"\u003cinteger\u003e","barcode":"\u003cstring\u003e","sku":"\u003cstring\u003e","mpn":"\u003cstring\u003e","gtin":"\u003cstring\u003e","updated_at":{"date":"\u003cdateTime\u003e","timezone_type":"\u003cnumber\u003e","timezone":"\u003cstring\u003e"},"related_options":["\u003cinteger\u003e","\u003cinteger\u003e"],"related_option_values":["\u003cinteger\u003e","\u003cinteger\u003e"],"weight":"\u003cnumber\u003e","weight_type":"\u003cstring\u003e","weight_label":"\u003cstring\u003e","is_user_subscribed_to_sku":"\u003cboolean\u003e","is_default":"\u003cboolean\u003e"}}