Product Variations
This is used to view, create, update and delete product variations.
Product Variation Properties
| id |
{ "id" : 255 }
The unique ID of the product variation |
| price |
{ "price": 9.95 }
The individual price for the product variation, if not set the main product price will be used |
| sku |
{ "sku" : "SKU101"}
The SKU code for the product variation, required if you want to manage stock for the product variation |
| stock |
{ "stock" : 1 }
The stock quantity for the product variation, if a SKU code is set but not the quantity, it will be treated as 0 |
| weight |
{ "weight" : 1.00 }
The weight for the product variation |
| image |
{ "image" : 1 }
The image index for the product variation (what product image should be shown when the variation is selected) |
| values |
{ "values" : [
{
"id": 1,
"name": "Small",
"option": {
"id": 1,
"name": "Size"
}
}
]
}
The IDs for product option values assigned to the variation |
What you can do with product variations
GET /v1/products/ID/variations
Receive a list of all product variations
GET /v1/products/ID/variations/ID
Receive a product variation
POST /v1/products/ID/variations
Create a new product variation
PUT /v1/products/ID/variations/ID
Update a product variation
DELETE /v1/products/ID/variations/ID
Delete a product variation
GET /v1/products/ID/variations
Returns all product variations.
GET /v1/products/1/variations
HTTP/1.1 200 OK
[
{
"id": 1,
"price": 9.95,
"sku": "SKU101",
"weight": 1.00,
"stock": 1,
"image": 2,
"values": [
{
"id": 1,
"name": "Small",
"option": {
"id": 1,
"name": "Size"
}
},
{
"id": 2,
"name": "Red",
"option": {
"id": 2,
"name": "Colour"
}
}
]
}
]
GET /v1/products/ID/variations/ID
Returns a single product variation.
GET /v1/products/1/variations/1
HTTP/1.1 200 OK
{
"id": 1,
"price": 9.99,
"sku": "SKU",
"weight": 0,
"stock": 10,
"image": 2,
"values": [
{
"id": 1,
"name": "Small",
"option": {
"id": 1,
"name": "Size"
}
},
{
"id": 2,
"name": "Red",
"option": {
"id": 2,
"name": "Color"
}
}
]
}
POST /v1/products/ID/variations
Creates a new product variation.
POST /v1/products/1/variations
POST /v1/products/1/variations
{
"values": [1, 2]
}
POST /v1/products/1/variations
HTTP/1.1 201 Created
{
"id": 1,
"price": 0,
"sku": "",
"weight": 0,
"stock": 0,
"image": 0,
"values": [
{
"id": 1,
"name": "Small",
"option": {
"id": 1,
"name": "Size"
}
},
{
"id": 2,
"name": "Red",
"option": {
"id": 2,
"name": "Color"
}
}
]
}
PUT /v1/products/ID/variations/ID
Update a product variation.
PUT /v1/products/1/variations/1
PUT /v1/products/1/variations/1
{
"stock": 99
}
PUT /v1/products/1/variations/1
HTTP/1.1 200 OK
{
"id": 1,
"price": 0,
"sku": "",
"weight": 0,
"stock": 99,
"image": 0,
"values": [
{
"id": 1,
"name": "Small",
"option": {
"id": 1,
"name": "Size"
}
},
{
"id": 2,
"name": "Red",
"option": {
"id": 2,
"name": "Color"
}
}
]
}
DELETE /v1/products/variations/ID
Deletes an existing product variation.
Returns 204 No Content on success.