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:
Update variant-specific attributes like size, color, or SKU.
Adjust pricing or inventory details for a particular variant.
Request Parameters
Path Parameters
Parameter
Type
Required
Example
Description
variant_id
string
Yes
"ABC123"
The ID of the variant to be updated.
Body Parameters
Parameter
Type
Required
Example
Description
variant.option1
string
No
Red
The first option for the variant (e.g., color, size).
variant.option2
string
No
Large
The second option for the variant.
variant.option3
string
No
Cotton
The third option for the variant.
variant. compare_at_price
string
No
29.99
The original price of the variant before any discounts.
variant. image_id
string
No
8ef098c5-5a08-44b4-b5fb-89214bb507dc
The ID of the image associated with the variant.
variant. price
string
Yes
19.99
The current price of the variant.
variant. position
integer
Yes
1
The position of the variant in the list of product variants.
variant.sku
string
No
T-M-L-red
Stock Keeping Unit (SKU) for the variant.
variant. barcode
string
No
6929000212340
The barcode associated with the variant.
variant.note
string
No
Limited Edition
Notes or additional information about the variant.
variant. inventory_quantity
integer
No
50
The number of items available in inventory for the variant.
variant.weight
string
No
1.2
The weight of the variant.
variant. weight_unit
string
No
kg
The unit of measurement for the weight (e.g., kg, lb).
Additional details about the variant's dimensions or origin.
variant.extend.length
number
10
length
variant.extend.width
number
10
width
variant.extend.height
number
10
height
variant.extend.dimension_unit
string
"in"
dimension_unit
variant.extend.origin_country_code
string
"AS"
Country of origin code of the product.
variant.extend.hs_code
string
"6211439"
HS codes are the international standard for commodity classification, and Shoplazza can automatically generate HS codes based on commodity information.
Error Response
Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field
Type
Example
Description
errors
Array
["No variants found"]
A list of errors encountered during the request processing.
Field
Type
Example
Description
error
Array
"store is not active"
Indicates an error encountered during the process.
Error Details
Status Code
Message
Possible Reason
Example Response
400
Bad Request
Invalid input format or request structure (e.g., missing required fields or incorrect data types).
Bad Request
Unauthorized
The request is missing valid authentication credentials or the credentials provided are invalid.
Unauthorized
422
No variants found
The variant ID provided in the request does not exist.
{ "errors": [ "No variants found"] }
Invalid or empty variant_id
missing required variant_id or variant_id with incorrect UUID types
{ "errors": [ "variant_id has an invalid UUID"]}
API Structure Overview
Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!