Update Variant By SKU

🔒

Requires write_product access scope. More access scope

The Update Variant by SKU API allows users to update the details of a specific product variant using its SKU. This endpoint is useful for managing inventory, pricing, and other variant-specific attributes by targeting the unique SKU of a variant. It provides flexibility in updating multiple fields of the variant in a single API call.This API is especially useful for:

  1. Update inventory and pricing details for a specific SKU.
  2. Modify metadata such as barcode, weight, or custom notes for better variant management.

Request Parameters

Path Parameters

ParameterTypeRequiredExampleDescription
skustringYes"ABC123"SKU of the product to retrieve variants.

Body Parameters

FieldTypeRequiredExampleDescription
compare_at_pricestringNo"99.99"The original price of the variant before discount.
pricestringNo"79.99"The current price of the variant.
barcodestringNo"123456789"The barcode for the variant for inventory or sales tracking.
notestringNoSeasonal saleCustom notes or remarks for the variant.
inventory_quantityintNo100The current inventory level for the variant.
weightstringNo"1.5"The weight of the variant.
weight_unitstringNokgThe unit of measurement for the weight. (e.g., kg, g, lb, oz)
cost_pricestringNo"50.00"The cost price of the variant.
retail_pricestringNo"120.00"The recommended retail price for the variant.
refuse_multi_resultboolNotruefalse: If sku matches multiple sub-items, update the matched sub-items normally.
true: Rejects the update if the sku matches more than one subitem

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Success Response

Field Type Example Description
variant.id string 1b735278-62c7-41ad-9976-b1b63a90590d Unique identifier for the variant.
variant.product_id string 636a07da-39eb-4829-bde9-b65fae1c28b0 Unique identifier for the associated product.
variant.image_id string 91d032e7-bbc8-47e4-8668-9ba6fe714de6 Unique identifier for the associated image.
variant.created_at string (date) 2024-04-15T02:00:57Z Timestamp indicating when the variant was created.
variant.updated_at string (date) 2024-04-15T02:00:57Z Timestamp indicating when the variant was last updated.
variant.title string S-red Title of the variant.
variant.option1 string S First option value for the variant (e.g., size).
variant.option2 string red Second option value for the variant (e.g., color).
variant.option3 string "" Third option value for the variant, if applicable.
variant.image object Image Object
variant.image.src string //cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png URL of the image associated with the variant.
variant.image.width integer 1588 Width of the variant image in pixels.
variant.image.height integer 2246 Height of the variant image in pixels.
variant.image.path string efd33b921cacd5311a32dd03a9bc8740.png File path of the variant image.
variant.image.alt string "" Alternative text for the variant image.
variant.position integer 1 Position of the variant in the product's variant list.
variant.compare_at_price string 100.00 Original price of the variant before discounts.
variant.price string 100.00 Current price of the variant.
variant.sku string S-RED Stock Keeping Unit (SKU) for the variant.
variant.barcode string 123 Barcode associated with the variant.
variant.note string s-red Notes or additional information about the variant.
variant.inventory_quantity integer 10 Number of items available in inventory for the variant.
variant.weight string 0.10 Weight of the variant.
variant.weight_unit string kg Unit of measurement for the weight (e.g., kg, lb).
variant.cost_price string 11.00 Cost price of the variant.
variant.wholesale_price object wholesale price object
variant.wholesale_price.price string 100.00 Wholesale price for the variant.
variant.wholesale_price.min_quantity integer 1 Minimum quantity required to avail the wholesale price.
variant.extend object extend object 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.

FieldTypeExampleDescription
errorsArray["Record not found"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorArray "store is not active"Indicates an error encountered during the process.

Error Details

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
4221.sku Not Found,2.Invalid or empty sku1.The variant SKU provided in the request does not exist.
2. Missing or invalid SKU
{ "errors": ["Record not found"] }

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!