Update a variation
PUT/pcm/variations/:variationID
Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the variation is not updated.
Request
Path Parameters
A unique identifier for the variation.
- application/json
Body
data objectrequired
Possible values: [product-variation
]
This represents the type of resource object being returned. Always product-variation
.
attributes objectrequired
The variation name.
The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the sort_order
value to program your storefront to display the variation options in the order that you want.
The variation with the highest value of sort_order
is displayed first. For example, a variation with a sort_order
value of 3 appears before a variation with a sort_order
value of 2.
You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set sort_order
to either null
or omit it entirely from the request if you wish to remove an existing sort_order
attribute.
You must rebuild your products for the sort order changes to take effect.
The unique identifier of the variation. Must match the variation ID specified in the request path.
Responses
- 200
- 403
- 404
- 409
- 422
- 500
Returns an updated variation with the following attributes.
- application/json
- Schema
- Example (from schema)
- update-variation
Schema
- Array [
- ]
data objectrequired
A unique identifier for a variation.
Possible values: [product-variation
]
This represents the type of resource object being returned. Always product-variation
.
attributes objectrequired
The name for a variation.
The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the sort_order
value to program your storefront to display the variation options in the order that you want. The variation with the highest value of sort_order
is displayed first. For example, a variation with a sort_order
value of 3 appears before a variation with a sort_order
value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set sort_order
to either null
or omit it entirely from the request if you wish to remove an existing sort_order
attribute.
meta objectrequired
options object[]
A variation option represents an option for selection for a single product-variation. For example, if your variation is color
, you might have three possible options; red, green, and blue.
A unique ID that is generated an option is created.
A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.
A description for an option.
The date and time an option is created.
The date and time an option is updated.
The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the sort_order
value to program your storefront to display the variation options in the order that you want. The variation with the highest value of sort_order
is displayed first. For example, a variation with a sort_order
value of 3 appears before a variation with a sort_order
value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set sort_order
to either null
or omit it entirely from the request if you wish to remove an existing sort_order
attribute.
Possible values: [organization
, store
]
The owner of the resource, either organization
or store
.
The date and time a variation is created.
The date and time a variation is updated.
{
"data": {
"id": "string",
"type": "product-variation",
"attributes": {
"name": "string",
"sort_order": 0
},
"meta": {
"options": [
{
"id": "string",
"name": "string",
"description": "string",
"created_at": "2020-09-22T09:00:00",
"updated_at": "2020-09-22T09:00:00",
"sort_order": 0
}
],
"owner": "organization",
"created_at": "string",
"updated_at": "string"
}
}
}
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "product-variation",
"attributes": {
"name": "Paint Color",
"sort_order": 1
},
"meta": {
"options": [
{
"id": "3de2c96c-2a99-4ded-bcf8-eeba32c0c5be",
"name": "Red",
"description": "Red color",
"sort_order": 2,
"created_at": "2024-01-25T11:25:38.001Z",
"updated_at": "2024-01-25T11:25:38.001Z"
},
{
"id": "31f2d09b-8a10-447a-b3ad-3358d07f818a",
"name": "Blue",
"description": "Blue color",
"sort_order": 1,
"created_at": "2024-01-25T11:25:38.001Z",
"updated_at": "2024-01-25T11:25:38.001Z"
}
],
"owner": "store",
"created_at": "2024-01-25T11:25:38.001Z",
"updated_at": "2024-01-25T11:25:38.001Z"
}
}
}
Forbidden
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Forbidden",
"status": "403",
"detail": "entity owned by organization"
}
]
}
Bad Request. Not Found.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Not Found",
"status": "404"
}
]
}
Write conflict detected
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Conflict",
"status": "409",
"detail": "write conflict detected"
}
]
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- failed-validation
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Failed Validation",
"status": "422",
"detail": "<XYZ> can not be empty"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors undefined[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"status": "500",
"title": "Internal Server Error",
"detail": "There was an internal server error, you can report with your request id.",
"request_id": "635da56d-75a1-43cd-b696-7ab119756b3a"
}
]
}