Skip to content

Update a product

PUT
/api/v1/commerce/products/{id}
curl --request PUT \
--url https://digize.com/api/v1/commerce/products/example \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \
--header 'x-api-key: <x-api-key>' \
--data '{ "name": "example", "slug": "example", "description": "example", "category": "example", "vendor": "example", "type": "physical", "status": "active", "color": "primary", "tags": [ "example" ], "options": [ { "name": "example", "values": [ "example" ] } ], "variants": [ { "id": "example", "label": "example", "options": [ "example" ], "sku": "example", "barcode": "example", "price": 1, "cost": 1, "compareAtPrice": 1, "weight": 1, "reorderAt": 1, "onHand": 1, "imageId": "example" } ], "channels": [ "storefront" ], "chargeTax": true, "continueSelling": true, "seo": { "title": "example", "description": "example" }, "images": [ { "imageId": "example", "alt": "example" } ], "subscription": { "interval": "week", "every": 1 }, "collectionIds": [ "example" ] }'

Saves a product and its variants as given: variants left out are deleted, and onHand sets the count on hand.

Needs the commerce:write permission.

id
required
string
>= 1 characters <= 64 characters
Idempotency-Key
string
>= 1 characters <= 255 characters

Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.

Example

5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69
Media typeapplication/json
object
name
required
string
<= 120 characters
slug

The storefront URL segment; made from the name when left out.

string
<= 80 characters
description
string
<= 20000 characters
category
string
<= 60 characters
vendor
string
<= 80 characters
type
required
string
Allowed values: physical digital subscription
status
required
string
Allowed values: active draft archived
color
string
Allowed values: primary accent secondary success warning info destructive
tags
Array<string>
<= 50 items
options
Array<object>
<= 3 items
object
name
required
string
<= 40 characters
values
required
Array<string>
<= 100 items
variants
required
Array<object>
>= 1 items <= 100 items
object
id

Left out for a new variant.

string
>= 1 characters <= 64 characters
label
required
string
<= 120 characters
options
Array<string>
<= 3 items
sku
string
<= 64 characters
barcode
string
<= 64 characters
price
required

In the store currency’s minor unit: 1900 is $19.00.

integer
<= 100000000
cost

In the store currency’s minor unit: 1900 is $19.00.

integer
<= 100000000
compareAtPrice
Any of:

In the store currency’s minor unit: 1900 is $19.00.

integer
<= 100000000
weight
integer
<= 1000000
reorderAt
integer
<= 1000000
onHand

Sets the count on hand.

integer
>= -100000 <= 10000000
imageId
Any of:
string
<= 120 characters
channels
Array<string>
Allowed values: storefront wholesale
chargeTax
boolean
continueSelling
boolean
seo
object
title
string
<= 120 characters
description
string
<= 320 characters
images

Upload each first with commerce.products.createImageUpload.

Array<object>
<= 20 items
object
imageId
required
string
<= 120 characters
alt
required
string
<= 200 characters
subscription
Any of:
object
interval
required
string
Allowed values: week month
every
required
integer
>= 1 <= 12
collectionIds

The manual collections it’s in.

Array<string>
<= 100 items

Done

Media typeapplication/json
object
id
required
string
slug
required
string
name
required
string
category
required
string
type
required
string
Allowed values: physical digital subscription
status
required
string
Allowed values: active draft archived
color
required
string
Allowed values: primary accent secondary success warning info destructive
description
required
string
vendor
required
string
tags
required
Array<string>
options
required
Array<object>
object
name
required
string
<= 40 characters
values
required
Array<string>
<= 100 items
variants
required
Array<object>
object
id
required
string
sku
required
string
label
required

“12 oz · Whole bean”, or “Default” for a product with one variant.

string
options
required
Array<string>
price
required
number
cost
required
number
onHand
required

On hand at the locations that ship online orders.

number
reserved
required

Held by open checkouts for 30 minutes.

number
reorderAt
required
number
compareAtPrice
required
number | null
barcode
required
string
weight
required

In grams.

number
imageId
required
string | null
channels
required
Array<string>
Allowed values: storefront wholesale
chargeTax
required
boolean
continueSelling
required
boolean
seo
required
object
title
required
string
description
required
string
images
required
Array<object>
object
imageId
required
string
alt
required
string
thumb
required
string
url
required
string
subscription
required
Any of:
object
interval
required
string
Allowed values: week month
every
required
integer
>= 1 <= 12
createdAt
required
string format: date-time
updatedAt
required
string format: date-time

Example

{
"type": "physical",
"status": "active",
"color": "primary",
"channels": [
"storefront"
],
"subscription": {
"interval": "week"
}
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

A request with the same Idempotency-Key is still running (conflict).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The Idempotency-Key was used with a different request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}