Requires
write_product
access scope. For more access scope
Important Note: When updating the same product, the updateProduct API is more performant than updateVariant. If there are multiple updates for the same product (e.g., updating variant prices), it is strongly recommended to use updateProduct to avoid potential locking issues. This ensures better performance and reduces delays.
The Update Product API allows developers to update product details by using its unique domain prefix (shopdomain) and providing various configurable fields. This endpoint supports modifying specific fields such as product title, description, variants and images. It is particularly useful for managing product catalog updates and maintaining accurate product information.This API is especially useful for:
-
Updating product metadata like title, description, and SEO fields through its unique identifier (product_id).
-
Managing product variants, options, and inventory details.
Request Parameters
Public Request Parameters
Path Parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
product_id | string | Yes | 9fb9f3c6-2300-42c1-8593-d9008d7cfc09 | The unique identifier for the product. |
Body Parameters
Field | Type | Required | Description | Example |
---|---|---|---|---|
title | String | Yes | The title of the product. | "Test Product" |
brief | String | No | A brief description of the product. | "Short description of product" |
description | String | No | Detailed description of the product. | "Detailed description here." |
published | Boolean | No | Indicates if the product is published. | true |
requires_shipping | Boolean | No | Specifies if shipping is required for the product. | false |
taxable | Boolean | No | Indicates if the product is taxable. | true |
tags | String | No | Tags for categorizing the product, separated by commas. | "tag1,tag2" |
vendor | String | No | Name of the vendor for the product. | "Vendor Name" |
vendor_url | String | No | Vendor's URL. | "https://vendor-website.com" |
note | String | No | Notes associated with the product. | "Additional notes" |
seo_title | String | No | SEO-friendly title for the product. | "SEO Title" |
seo_description | String | No | SEO description for the product. | "SEO Description" |
seo_keywords | String | No | SEO keywords separated by commas. | "keyword1,keyword2" |
handle | String | No | URL handle for the product. | "product-handle" |
has_only_default_variant | Boolean | Yes | Indicates if the product has only a default variant. | true |
inventory_tracking | Boolean | No | Specifies if inventory tracking is enabled. | true |
inventory_policy | String | No | Inventory policy (e.g., `continue`, `deny`, `auto_unpublished`). | "continue" |
need_variant_image | Boolean | No | Specifies if a variant image is needed. | false |
spu | String | No | Stock-keeping unit (SPU) for the product. | "SPU12345" |
fake_sales | Integer | No | Fake sales count for display purposes. | 100 |
display_fake_sales | Boolean | No | Whether to display fake sales count. | true |
options | Array of Objects | No | Product options like size or color. | [{"name": "Size", "values": ["S", "M", "L"]}] |
options.name | String | Required if new options | Product option's name. | "Size" |
options.values | Array of Strings | Required if new options | Options list. | ["S", "M", "L"] |
Images | Array of Objects | No | Images associated with the product. | [{"src": "image_url", "alt": "Alt text"}] |
images.src | String | Required if new images | URL of the image. | "image_url" |
images.width | Integer | No | Width of the image in pixels. | 100 |
images.height | Integer | No | Height of the image in pixels. | 100 |
images.alt | String | No | Alt text for the image. | "Alt text" |
Variants | Array of Objects | No | Variants of the product, including price and options. | [{"option1": "S", "price": 19.99}] |
variants. option1 |
String | No | First option value. | "S" |
variants. option2 |
String | No | Second option value. | "Black" |
variants. option3 |
String | No | Third option value. | "Light" |
variants. price |
String | Yes | The price of the variant. | "29.99" |
variants. image.src |
String | Yes | "https://cdn.shoplazza.com/sample.jpg" | URL of the image file. |
variants. |
Integer | No | 100 | Width of the image in pixels. |
variants. |
Integer | No | 200 | Height of the image in pixels. |
variants. |
String | No | "Product Image" | Alternative text for the image. |
variants. |
String | No | "2024-04-23T09:32:57.090041356+08:00" | Timestamp when the image was created. |
variants. |
String | No | "2024-04-23T09:32:57.090041356+08:00" | Timestamp when the image was last updated. |
variants.sku | String | No | Stock Keeping Unit for the variant. | "SKU12345" |
variants. barcode |
String | No | Barcode of the variant. | "123456789012" |
variants. inventory_quantity |
Integer | No | Available inventory quantity. | 100 |
unique_token | String | Yes | Unique token for idempotency verification. | "e6cc4df1-d4f5-4ad4-a019-2e0f3ddd6e63" |
variants.note | String | No | Additional notes about the variant. | "Additional details for the variant" |
variants.weight | String | No | The weight of the variant. | "1.5" |
variants. weight_unit |
String | No | Possible values: `kg`, `g`, `lb`, `oz`. | "kg" |
variants. cost_price |
String | No | The cost price of the variant. | "10.00" |
variants.wholesale_price | Array | No | Wholesale pricing information. | [{"price": 8.99, "min_quantity": 10}] |
variants.wholesale_price.price |
String | Yes | "8.99" | The wholesale price for the product variant. |
variants. |
Integer | Yes | 10 | The minimum quantity required to qualify for the wholesale price. |
inventory_policy | String | No | Policy for inventory management (`continue`, `deny`). | "continue" |
mixed_wholesale |
Boolean | No | true | Indicates if mixed wholesale pricing is supported, allowing different products to be combined to meet the minimum quantity requirement. |
unique_token | String | Yes | Unique token for idempotency verification. | "e6cc4df1-d4f5-4ad4-a019-2e0f3ddd6e63" |
Response Explanation
Public Response Parameters
Successful Response
Field | Type | Example | Description |
---|---|---|---|
product.id |
string |
"9fb9f3c6-2300-42c1-8593-d9008d7cfc09" |
Unique identifier for the product. |
product.title |
string |
"Stylish Shirt" |
Title of the product. |
product.brief |
string |
"A stylish shirt." |
Brief description or summary of the product. |
product. |
string |
"" |
Full description of the product. |
product. |
boolean |
true |
Indicates whether the product is published. |
product. |
boolean |
true |
Indicates if the product requires shipping. |
product. |
boolean |
true |
Indicates if the product is subject to tax. |
product.tags |
string |
"shirt,stylish,cotton" |
Tags associated with the product, separated by commas. |
product.vendor |
string |
"Awesome Vendor" |
Name of the product vendor. |
product.vendor_url |
string |
"https://awesomevendor.com" |
URL of the vendor's website. |
product. |
integer |
300 |
Total inventory available for the product. |
product. |
string (ISO8601) |
"2024-12-03T19:02:30Z" |
Timestamp when the product was published. |
product. |
string (ISO8601) |
"2024-12-03T19:02:30Z" |
Timestamp when the product was created. |
product. |
string (ISO8601) |
"2024-12-03T19:02:30Z" |
Timestamp when the product was last updated. |
product.note |
string |
"Special promotion item." |
Notes or special remarks about the product. |
product. |
string |
"Buy Stylish Shirt Online" |
SEO-friendly title for the product. |
product. |
string |
"Premium cotton" |
SEO-friendly description for the product. |
product. |
string |
"shirt, cotton, stylish" |
SEO keywords for the product, separated by commas. |
product.handle |
string |
"stylish-shirt-zbxf" |
URL-friendly handle for the product. |
product. |
boolean |
false |
Indicates if the product has only the default variant. |
product. |
string |
"//img.fantaskycdn.com/loading.png" |
Source URL of the product's main image. |
product. |
integer |
100 |
Width of the product's main image in pixels. |
product. |
integer |
100 |
Height of the product's main image in pixels. |
product. |
string |
"loading.png" |
File path of the product's main image. |
product. |
string |
"" |
Alternative text for the product's main image. |
product.images |
array of image object | See images fields below |
Array of additional images for the product. |
product.images[].id |
string |
"15333433-a0d5-44c9-941b-2c59ea07683e" |
Unique identifier for the image. |
product.images[]. |
string |
"9fb9f3c6-2300-42c1-8593-d9008d7cfc09" |
ID of the product associated with the image. |
product.images[]. |
integer |
1 |
Position of the image in the gallery. |
product.images[]. |
string |
"//img.fantaskycdn.com/loading.png" |
Source URL of the image. |
product. |
string |
"d7c7f9ba-f824-46b6-94af-1c2d1befaf27" |
Unique identifier for the variant. |
product. |
string |
"Small-Red" |
Title of the variant. |
product. |
string |
"Small" |
Value of the first option for the variant. |
product. |
string |
"Red" |
Value of the second option for the variant. |
product. |
string |
"19.99" |
Price of the variant. |
product. |
string |
"SS1234-RD-S" |
Stock Keeping Unit (SKU) for the variant. |
product. |
integer |
100 |
Inventory quantity for the variant. |
product. |
array of wholesale price | See wholesale_price fields below |
Wholesale price information for the variant. |
product. |
string |
"19.99" |
Wholesale price for the variant. |
product.variants[]. |
integer |
1 |
Minimum quantity for the wholesale price. | product.category |
Object |
Category object | Category information for the product. |
product.category.id |
integer |
368313940138040900 | The ID of the category. |
product. |
string |
"3" | Category name. |
product. |
integer |
0 | Google category ID. |
product. |
integer |
"3" | Level of category. |
product. |
string |
"368313940138008142, 368313940138024526, 368313940138040910" |
The full path of a category, consisting of category IDs. |
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 | ["Context"] | 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 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 | ["Context"] | 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 Response Example
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 | |
404 | Product Not Found | The product ID provided in the request does not exist. | { "errors": ["Product not found"] } |
422 | Failed Validation | One or more fields failed validation checks. | { "errors": [ "Variant price must be entered."]} |
Invalid or empty id | missing required id or id with incorrect UUID types | { "errors": [ "Id is not an invalid UUID"]} |