/products/id
Updates an existing product. If it has been purchased before, its data will remain untouched in orders.
URL parameters
Parameters that you can append to the URL, for example: ?parameter=value
Title | Type | Description | Required? |
---|---|---|---|
id | int | ID of a single product to update. Can be used after the slash. Example: products/27 update product with ID 27 | Yes |
Request body attributes
Parameters that you can send in the request body in JSON format, for example:
{"id": 1,"title": "Product"}
Title | Type | Description | Required? |
---|---|---|---|
title | string | Title of the product | No |
is_multi | bool | If the product is multi variant as opposed to single variant | No |
type | string | Type of the product, for example Shirts | No |
collections | array of ints | Array containing IDs of collections that the product belongs to. Only returns collections with manual addition of products | No |
tags | array of strings | Tags assigned to the product | No |
shipping_weight | float | Shipping weight of the product | No |
auto_fulfilment | bool | Whether automatic fulfilment is enabled | No |
track_inventory | bool | Whether product is tracked in Inventory | No |
vendor | string | Name of the vendor that supplies the product | No |
sku | string | SKU of the product | No |
seo_meta | string | Meta for SEO | No |
seo_title | string | Page title for SEO | No |
seo_url | string | Page URL for SEO. Generates automatically from title | No |
is_template | bool | Whether this is a template to create products from | No |
is_draft | bool | Whether this product is a draft that is not published | No |
price | float | Price of the product, for single variant products | No |
compare_price | float | Compare price of the product, for single variant products | No |
textareas | object containing arrays | Custom pieces of text that can be displayed as tabs on the product page. Only the titles that have been pre-set on Product settings page can be used here | No |
textareas.name | string | Title of the tab. Only the titles that have been pre-set on Product settings page can be used here | Yes, if textareas are used |
textareas.text | string | Text contents of the tab | Yes, if textareas are used |
images | array of ints | Image IDs for the product. Used if no variants change product look. Images have to be uploaded first through the Images API | No |
options | object containing arrays | Options for multi-variant products | Yes, if product is multi variant |
options.title | string | Title of the option, for example Color | Yes, if options are used |
options.changes_look | bool | Whether this option changes look of the product | No |
options.values | array of strings | Values of the option, for example Red and Blue | Yes, if options are used |
options.thumbnails | object containing arrays | Thumbnails that will be used in the variant selector on the product page | No |
options.thumbnails.value | string | Value of the option for which the thumbnail is used, for example Red | Yes, if thumbnails are used |
options.thumbnails.color | string | Color of the selector thumbnail, HEX value. Either color or image is used. | No |
options.thumbnails.image | id | Image ID for the selector thumbnail. Either color or image is used. Images have to be uploaded first through the Images API | No |
variants | object containing arrays | Variants resulting from combining of options | No |
variants.variant | array of strings | A combination of options, for example Red and Big | Yes, if variants are used |
variants.price | float | Price of the variant | Yes, if variants are used |
variants.compare_price | float | Compare price of the variant | No |
variants.sku | string | SKU of the variant | No |
variants.default | bool | Whether the variant is default | No |
variants.ignore | bool | Whether the variant should not be used | No |
variants.images | array of ints | Array containing image IDs for the variant if it changes product look. Images have to be uploaded first through the Images API | No |
Response attributes
Attributes that you will receive in response from the endpoint in JSON format, for example:
{"id": 1,"title": "Product"}
Title | Type | Description |
---|---|---|
id | int | ID of the product |
title | string | Title of the product |
is_multi | bool | If the product is multi variant as opposed to single variant |
type | string | Type of the product, for example Shirts |
collections | array of ints | Array containing IDs of collections that the product belongs to. Only returns collections with manual addition of products |
tags | array of strings | Tags assigned to the product |
shipping_weight | float | Shipping weight of the product |
auto_fulfilment | bool | Whether automatic fulfilment is enabled |
track_inventory | bool | Whether product is tracked in Inventory |
vendor | string | Name of the vendor that supplies the product |
sku | string | SKU of the product |
seo_meta | string | Meta for SEO |
seo_title | string | Page title for SEO |
seo_url | string | Page URL for SEO. Generates automatically from title |
is_template | bool | Whether this is a template to create products from |
is_draft | bool | Whether this product is a draft that is not published |
PATCH https://mystore.commercehq.com/api/v1/products/18
{
"title": "Good product 123",
"price": 1,
"collections": [1],
"images": [8],
"tags":["tag1", "tag heuer"],
"type":"Shoes",
"vendor":"abidas",
"is_multi": true,
"options":[
{
"title": "Color",
"changes_look": false,
"values": ["red"]
},
{
"title": "Size",
"changes_look": false,
"values": ["S", "XL"],
"thumbnails": [
{
"value": "S",
"color": "#000",
"image": 7
}
]
}
],
"variants":[
{
"variant": ["red"],
"price": 1,
"compare_price": 1,
"sku": "abc",
"default": true,
"ignore": true,
"images": [12]
}
],
"seo_url": "good-product-123"
}
{
"id": 18,
"title": "Good product 123",
"is_multi": true,
"type": "Shoes",
"collections": [
1
],
"tags": [],
"shipping_weight": null,
"auto_fulfilment": false,
"track_inventory": false,
"vendor": "abidas",
"sku": null,
"seo_meta": null,
"seo_title": null,
"seo_url": "good-product-123",
"is_template": false,
"is_draft": false,
"created_at": 1485010678,
"updated_at": 1485010678
}