Variant
Variants are variations of the product. Prices, stock, size, weight, articleCode, SKU and EAN are set and tracked within the variant. An example would be a “T-shirt” product with three variants, sizes “Small”, “Medium”, and “Large”.
- GET All variants
- GET Number of variants
- GET Retrieve a variant
- POST Create a variant
- PUT Update a variant
- PUT Update in bulk
- DELETE Delete a variant
Example object
{
"variant": {
"id": 36285796,
"createdAt": "2019-07-24T15:23:06+00:00",
"updatedAt": "2019-08-01T16:10:58+00:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": "",
"unitPrice": 0,
"unitUnit": null,
"priceExcl": 0,
"priceIncl": 0,
"priceCost": 0,
"oldPriceExcl": 23,
"oldPriceIncl": 23,
"stockTracking": "indicator",
"stockLevel": 100,
"stockAlert": 5,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 0,
"weightValue": "0.000",
"weightUnit": "lb",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "fl_oz",
"colli": 0,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "in",
"matrix": false,
"title": "Default",
"taxType": "auto",
"image": {
"createdAt": "2019-08-01T16:10:27+00:00",
"updatedAt": "2019-08-01T16:10:27+00:00",
"extension": "png",
"size": 8016,
"title": "logo",
"thumb": "https://cdn.shoplightspeed.com/shops/111111/files/15142984/50x50x2/logo.png",
"src": "https://cdn.shoplightspeed.com/shops/111111/files/15142984/logo.png"
},
"tax": false,
"product": {
"resource": {
"id": 21881217,
"url": "products/21881217",
"link": "https://api.shoplightspeed.com/us/products/21881217.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=36285796",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=36285796"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/36285796/metafields",
"link": "https://api.shoplightspeed.com/us/variants/36285796/metafields.json"
}
},
"additionalcost": false,
"options": []
}
}
Properties
id | The unique numeric identifier for the variant.{“id”: {id}} |
createdAt | The date and time when the variant was created. (format: ISO-8601){“createdAt”: “2019-07-24T15:23:06+00:00”} |
updatedAt | The date and time when the variant was last updated. (format: ISO-8601){“updatedAt”: “2019-08-01T16:10:58+00:00”} |
isDefault | If the variant is the default. (format: boolean){“key”: “external_email”} |
sortOrder | The order of the variant. {“sortOrder”:1} |
articleCode | Merchant specific article code. {“articleCode”: “AB00000123”} |
ean | EAN (bar) code. {“ean”: “AB00000123”} |
sku | Stock keeping unit. {“sku”: “AB00000123”} |
hs | Harmonized System code, used for customs. {“hs”: “123456”} |
priceExcl | Price excluding tax. {“priceExcl”:1} |
priceIncl | Price including tax. {“priceIncl”:1.21} |
priceCost | Cost price of variant (for internal use only). {“priceCost”:0.25} |
oldPriceExcl | Old price excluding tax (to show discounted price in the shop). {“oldPriceExcl”:1} |
oldPriceIncl | Old price including tax (to show discounted price in the shop). {“oldPriceIncl”:1.21} |
stockTracking | Track stock (disabled = no tracking; enabled = tracking, disallow backorders; indicator = tracking, allow backorders). {“stockTracking”: “disabled|enabled|indicator”} |
stockLevel | Actual stock level. {“stockLevel”:100} |
stockAlert | Alert stock level below threshold. {“stockAlert”:0} |
stockMinimum | Preferred minimum stockLevel. {“stockMinimum”:0} |
stockSold | Amount of stock sold. {“stockSold”:0 |
stockBuyMinimum | Minimum order amount. {“stockBuyMinimum”:1} |
stockBuyMaximum | Maximum order amount. {“stockBuyMaximum”:10000} |
weight | Weight of variant in grams. {“weight”:250} |
weightValue | Weight when not in grams or when decimals are needed. {“weightValue”:250.25} |
weightUnit | Weight unit when not in grams or conversion into grams is needed. Gram is standard. {“weightUnit”: “g|kg|oz|lb”} |
volume | Volume of variant in ml. {“volume”:25} |
volumeValue | Volume when not in ml. {“volumeValue”:153.55} |
volumeUnit | Volume unit when not in ml or conversion into ml is needed. {“volumeUnit”: “fl_oz”} |
colli | Amount of colli. {“colli”:1} |
sizeX | Width in cm. {“sizeX”:10} |
sizeY | Height in cm. {“sizeY”:5} |
sizeZ | Length in cm. {“sizeZ”:3} |
sizeXValue | Width when not in cm or decimals are needed. {“sizeXValue”:33.78} |
sizeYValue | Height when not in cm or decimals are needed. {“sizeYValue”:76.32} |
sizeZValue | Length when not in cm or decimals are needed. {“sizeZValue”:5.7} |
sizeUnit | Size unit when not in cm or conversion into cm is needed. {“sizeUnit”: “in”} |
matrix | The matrix the variant relates to. {“matrix”: “A”} |
title | Variant title. {“title”: “Size M”} |
taxType | The type of tax. {“taxType”: “auto|electronic_service”} What are electronically supplied services? Services which are delivered over the Internet or an electronic network and the nature of which renders their supply essentially automated and involving minimal human intervention, and impossible to ensure in the absence of information technology. Check the list |
unitPrice | To set a unit price. (type: Float){“unitPrice”:9.8} |
unitUnit | Unit for the price per unit. Must be in following list: ‘Centimeter’, ‘Decimeter’, ‘Foot’, ‘Hectometer’, ‘Inch’, ‘Kilometer’, ‘Meter’, ‘Micrometer’, ‘Mile’, ‘Millimeter’, ‘Yard’, ‘Acre’, ‘Are’, ‘Hectares’, ‘Square centimeter’, ‘Square feet’, ‘Square inch’, ‘Square kilometer’, ‘Square meter’, ‘Square mile’, ‘Square millimeter’, ‘Square yard’, ‘Carat’, ‘Gram’, ‘Kilogram’, ‘Milligram’, ‘Ounce’, ‘Pound’, ‘Stone’, ‘Ton’, ‘Tones’, ‘Cubic centiliter’, ‘Cubic centimeter’, ‘Cubic decimeter’, ‘Cubic decameter’, ‘Cubic feet’, ‘Cubic inch’, ‘Cubic meter’, ‘Cubic millimeter’, ‘Cubic Yard’, ‘Deciliter’, ‘Gallon’, ‘Liter’, ‘Milliliter’, ‘Piece’, ‘Pair’, ‘Capsule’, ‘Tablet’ (type: String){“unitUnit”: “Meter”} |
options | {“options”: [{“values”:[{“sortOrder”: 1, “id”: 168, “name”: “Black”}, {“sortOrder”: 2, “id”: 169, “name”:”White”}], “sortOrder”: 1, “id”: 76, “value”: {“sortOrder”: 1, “id”: 168, “name”: “Zwart”}, “createdAt”: “2014-11-06T11:33:32+01:00”, “updatedAt”: “2014-11-06T11:33:32+01:00”, “name”: “Color”}, {“values”: [{“sortOrder”: 1, “id”: 170, “name”: “S” }, {“sortOrder”: 2, “id”: 171, “name”: “M”}, {“sortOrder”: 3, “id”: 172, “name”: “L”}], “sortOrder”: 2, “id”: 77, “value”: {“sortOrder”: 1, “id”: 170, “name”: “S”}, “createdAt”: “2018-11-06T11:33:32+01:00”, “updatedAt”: “2018-11-06T11:33:32+01:00”, “name”: “Size”}]} |
tax | Link to Tax resource. {“tax”: “taxes/{tax_id}”} |
product | Link to Product resource. {“product”: “products/{product_id}”} |
movements | Link to VariantMovement resource. {“movements”: “variants/movements?variant={variant_id}”} |
metafields | Link to VariantMetafield resource. {“metafields”: “variants/{variant_id}/metafields”} |
additionalcost | Link to AdditionalCost resource. {“additionalcost”: “additionalcosts/{additionalcost_id}”} |
image | Attach an image to a variant. The base64 encoded version. {“variant”: {“image”: {“attachment”: “R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=”, “filename”: “test.jpg”}}} |
GET All variants
Retrieve a list of all variant objects from this shop. Note: you can retrieve the variants of a specific productby adding a query parameter containing the product id . Ex: /variants.json?product=20967267
Definition
GET /variants.json
Example request
curl https://api.shoplightspeed.com/en/variants.json \
-u {key}:{secret}
<?php $api->variants->get();
Definition
GET /variants.json
Example response
{
"variants": [
{
"id": 188992150,
"createdAt": "2019-05-31T20:49:33+02:00",
"updatedAt": "2019-08-01T20:46:01+02:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": null,
"unitPrice": 10,
"unitUnit": "Foot",
"priceExcl": 53.719,
"priceIncl": 65,
"priceCost": 10,
"oldPriceExcl": 95,
"oldPriceIncl": 114.95,
"stockTracking": "indicator",
"stockLevel": 19,
"stockAlert": 5,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 1000,
"weightValue": "1.000",
"weightUnit": "kg",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 0,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default",
"taxType": "",
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 94440643,
"url": "products/94440643",
"link": "https://api.shoplightspeed.com/us/products/94440643.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=188992150",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=188992150"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/188992150/metafields",
"link": "https://api.shoplightspeed.com/us/variants/188992150/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": 11426,
"url": "additionalcosts/11426",
"link": "https://api.shoplightspeed.com/us/additionalcosts/11426.json"
}
},
"options": []
},
{
"id": 182260997,
"createdAt": "2019-04-10T22:58:06+02:00",
"updatedAt": "2019-07-16T18:16:48+02:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": null,
"unitPrice": 0,
"unitUnit": "",
"priceExcl": 53.719,
"priceIncl": 65,
"priceCost": 0,
"oldPriceExcl": 95,
"oldPriceIncl": 114.95,
"stockTracking": "indicator",
"stockLevel": 17,
"stockAlert": 5,
"stockMinimum": 0,
"stockSold": 2,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 1000,
"weightValue": "1.000",
"weightUnit": "kg",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 0,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default",
"taxType": null,
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 91364615,
"url": "products/91364615",
"link": "https://api.shoplightspeed.com/us/products/91364615.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=182260997",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=182260997"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/182260997/metafields",
"link": "https://api.shoplightspeed.com/us/variants/182260997/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": false,
"url": "additionalcosts/",
"link": "https://api.shoplightspeed.com/us/additionalcosts/.json"
}
},
"options": []
}
]
}
Arguments
No arguments available. |
Filters
product | Retrieve all variants of a specific product. |
article_code | Retrieve all variants that have a specific article_code. |
ean | Retrieve all variants that have a specific EAN. |
sku | Retrieve all variants that have a specific SKU. |
hs | Harmonized System code, used for customs. {“hs”: “123456”} |
limit | Number of results. {(default: 50) (maximum: 250)} |
page | Page to show. {(default: 1)} |
since_id | Restrict results to after the specified ID. {(default: 0)} |
created_at_min | Show variants created after date. {(format: YYYY-MM-DD HH:MM:SS)} |
created_at_max | Show variants created before date. {(format: YYYY-MM-DD HH:MM:SS)} |
updated_at_min | Show variants last updated after date. {(format: YYYY-MM-DD HH:MM:SS)} |
updated_at_max | Show variants last updated before date. {(format: YYYY-MM-DD HH:MM:SS)} |
fields | Comma-separated list of fields to include in the response. {(format: id,createdAt)} |
GET Number of variants
Retrieve a list of all variant objects from this shop.
Definition
GET /variants/count.json
Example request
curl https://api.shoplightspeed.com/en/variants/count.json \
-u {key}:{secret}
<?php $api->variants->count($id);
Example response
{
"count": 10
}
Arguments
No arguments available. |
Filters
limit | Number of results. {(default: 50) (maximum: 250)} |
page | Page to show. {(default: 1)} |
since_id | Restrict results to after the specified ID. {(default: 0)} |
created_at_min | Show variants created after date. {(format: YYYY-MM-DD HH:MM:SS)} |
created_at_max | Show variants created before date. {(format: YYYY-MM-DD HH:MM:SS)} |
updated_at_min | Show variants last updated after date. {(format: YYYY-MM-DD HH:MM:SS)} |
updated_at_max | Show variants last updated before date. {(format: YYYY-MM-DD HH:MM:SS)} |
fields | Comma-separated list of fields to include in the response. {(format: id,createdAt)} |
GET Retrieve a variant
Retrieve a single variant based on the unique identifier.
Definition
GET /variants/{variant_id}.json
Example request
curl https://api.shoplightspeed.com/en/variants/{variant_id}.json \
-u {key}:{secret}
<?php $api->variants->get($variant_id);
Example response
{
"variant": {
"id": 188992150,
"createdAt": "2019-05-31T20:49:33+02:00",
"updatedAt": "2019-08-01T20:46:01+02:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": null,
"unitPrice": 10,
"unitUnit": "Foot",
"priceExcl": 53.719,
"priceIncl": 65,
"priceCost": 10,
"oldPriceExcl": 95,
"oldPriceIncl": 114.95,
"stockTracking": "indicator",
"stockLevel": 19,
"stockAlert": 5,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 1000,
"weightValue": "1.000",
"weightUnit": "kg",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 0,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default",
"taxType": "",
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 94440643,
"url": "products/94440643",
"link": "https://api.shoplightspeed.com/us/products/94440643.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=188992150",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=188992150"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/188992150/metafields",
"link": "https://api.shoplightspeed.com/us/variants/188992150/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": 11426,
"url": "additionalcosts/11426",
"link": "https://api.shoplightspeed.com/us/additionalcosts/11426.json"
}
},
"options": []
}
}
Arguments
id | The unique numeric identifier for the variant. {“id”: {id}} |
POST Create a variant
Create a new variant based on the given parameters.
Definition
POST /variants.json
Example request
curl -x POST https://api.shoplightspeed.com/en/variants.json \
-u {key}:{secret} \
-d variant[isDefault]=true \
-d variant[sortOrder]="1" \
-d variant[articleCode]="" \
-d variant[ean]="" \
-d variant[sku]="" \
-d variant[hs]="" \
-d variant[priceExcl]="0" \
-d variant[priceIncl]="0" \
-d variant[priceCost]="0" \
-d variant[oldPriceExcl ]="0" \
-d variant[oldPriceIncl]="0" \
-d variant[stockTracking]="disabled" \
-d variant[stockLevel]="100" \
-d variant[stockAlert]="0" \
-d variant[stockMinimum]="0" \
-d variant[stockSold]="0" \
-d variant[stockBuyMinimum]= "1" \
-d variant[stockBuyMaximum]= "10000" \
-d variant[weight]= "0" \
-d variant[volume]=" 0" \
-d variant[colli]= "1" \
-d variant[sizeX]= "0" \
-d variant[sizeY]= "0" \
-d variant[sizeZ]= "0" \
-d variant[title]= "Default" \
-d variant[tax]="18213" \
-d variant[product]="2301083"
-d image[attachment]="R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=" \
-d image[filename]="test.jpg"
<?php $api->variants->create([
"isDefault" => true,
"sortOrder" => 1,
"articleCode" => "",
"ean" => "",
"sku" => "",
"hs" => "",
"priceExcl" => 0,
"priceIncl" => 0,
"priceCost" => 0,
"oldPriceExcl" => 0,
"oldPriceIncl" => 0,
"stockTracking" => "disabled",
"stockLevel" => 100,
"stockAlert" => 0,
"stockMinimum" => 0,
"stockSold" => 0,
"stockBuyMinimum" => 1,
"stockBuyMaximum" => 10000,
"weight" => 0,
"volume" => 0,
"colli" => 1,
"sizeX" => 0,
"sizeY" => 0,
"sizeZ" => 0,
"title" => "Default",
"tax" => 18213,
"product" => 2301083,
"image" => [
"attachment" => "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="
"filename" => "test.jpg"
]
]);
Example Json payload
{
"variant": {
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": "",
"priceExcl": 0,
"priceIncl": 0,
"priceCost": 0,
"oldPriceExcl": 0,
"oldPriceIncl": 0,
"stockTracking": "disabled",
"stockLevel": 100,
"stockAlert": 0,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 0,
"volume": 0,
"colli": 1,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"title": "Default",
"tax": 18213,
"product": 2301083
}
}
Example response
{
"variant": {
"id": 196847073,
"createdAt": "2019-08-01T21:49:54+02:00",
"updatedAt": "2019-08-01T21:49:54+02:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": "",
"unitPrice": 0,
"unitUnit": null,
"priceExcl": 0,
"priceIncl": 0,
"priceCost": 0,
"oldPriceExcl": 0,
"oldPriceIncl": 0,
"stockTracking": "disabled",
"stockLevel": 100,
"stockAlert": 0,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 0,
"weightValue": "0.000",
"weightUnit": "g",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 1,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default2",
"taxType": null,
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 2301083,
"url": "products/2301083",
"link": "https://api.shoplightspeed.com/us/products/2301083.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=196847073",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=196847073"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/196847073/metafields",
"link": "https://api.shoplightspeed.com/us/variants/196847073/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": false,
"url": "additionalcosts/",
"link": "https://api.shoplightspeed.com/us/additionalcosts/.json"
}
},
"options": []
}
}
Arguments
isDefault | If the variant is the default. (format: boolean){“isDefault”: “true|false”} |
sortOrder | The order of the variant. {“sortOrder”:1} |
articleCode | Merchant specific article code. {“articleCode”: “AB00000123”} |
ean | EAN (bar) code. {“ean”: “AB00000123”} |
sku | Stock keeping unit. {“sku”: “AB00000123”} |
hs | Harmonized System code, used for customs. {“hs”: “123456”} |
priceExcl | Price excluding tax. {“priceExcl”:1} |
priceIncl | Price including tax. {“priceIncl”:1.21} |
priceCost | Cost price of variant (for internal use only). {“priceCost”:0.25} |
oldPriceExcl | Old price excluding tax (to show discounted price in the shop). {“oldPriceExcl”:1} |
oldPriceIncl | Old price including tax (to show discounted price in the shop). {“oldPriceIncl”:1.21} |
stockTracking | Track stock (disabled = no tracking; enabled = tracking, disallow backorders; indicator = tracking, allow backorders). {“stockTracking”: “disabled|enabled|indicator”} |
stockLevel | Actual stock level. {“stockLevel”:100} |
stockAlert | Alert stock level below threshold. {“stockAlert”:0} |
stockMinimum | Preferred minimum stockLevel. {“stockMinimum”:0} |
stockSold | Amount of stock sold. {“stockSold”:0 |
stockBuyMinimum | Minimum order amount. {“stockBuyMinimum”:1} |
stockBuyMaximum | Maximum order amount. {“stockBuyMaximum”:10000} |
weight | Weight of variant in grams. {“weight”:250} |
weightValue | Weight when not in grams or when decimals are needed. {“weightValue”:250.25} |
weightUnit | Weight unit when not in grams or conversion into grams is needed. Gram is standard. {“weightUnit”: “g|kg|oz|lb”} |
volume | Volume of variant in ml. {“volume”:25} |
volumeValue | Volume when not in ml. {“volumeValue”:153.55} |
volumeUnit | Volume unit when not in ml or conversion into ml is needed. {“volumeUnit”: “fl_oz”} |
colli | Amount of colli {“colli”:1} |
sizeX | Width in cm. {“sizeX”:10} |
sizeY | Height in cm. {“sizeY”:5} |
sizeZ | Length in cm. {“sizeZ”:3} |
sizeXValue | Width when not in cm or decimals are needed. {“sizeXValue”:33.78} |
sizeYValue | Height when not in cm or decimals are needed. {“sizeYValue”:76.32} |
sizeZValue | Length when not in cm or decimals are needed. {“sizeZValue”:5.7} |
sizeUnit | Size unit when not in cm or conversion into cm is needed. {“sizeUnit”: “in”} |
matrix | The matrix the variant relates to. {“matrix”: “A”} |
taxType | The type of tax. {“taxType”: “auto|electronic_service”} What are electronically supplied services? Services which are delivered over the Internet or an electronic network and the nature of which renders their supply essentially automated and involving minimal human intervention, and impossible to ensure in the absence of information technology. Check the list |
title | Variant title. {“title”: “Size M”} |
unitPrice | To set a unit price. (type: Float){“unitPrice”:9.8} |
unitUnit | Unit for the price per unit. Must be in following list: ‘Centimeter’, ‘Decimeter’, ‘Foot’, ‘Hectometer’, ‘Inch’, ‘Kilometer’, ‘Meter’, ‘Micrometer’, ‘Mile’, ‘Millimeter’, ‘Yard’, ‘Acre’, ‘Are’, ‘Hectares’, ‘Square centimeter’, ‘Square feet’, ‘Square inch’, ‘Square kilometer’, ‘Square meter’, ‘Square mile’, ‘Square millimeter’, ‘Square yard’, ‘Carat’, ‘Gram’, ‘Kilogram’, ‘Milligram’, ‘Ounce’, ‘Pound’, ‘Stone’, ‘Ton’, ‘Tones’, ‘Cubic centiliter’, ‘Cubic centimeter’, ‘Cubic decimeter’, ‘Cubic decameter’, ‘Cubic feet’, ‘Cubic inch’, ‘Cubic meter’, ‘Cubic millimeter’, ‘Cubic Yard’, ‘Deciliter’, ‘Gallon’, ‘Liter’, ‘Milliliter’, ‘Piece’, ‘Pair’, ‘Capsule’, ‘Tablet’ (type: String) {“unitUnit”: “Meter”} |
options | {“options”: [{“values”:[{“sortOrder”: 1, “id”: 168, “name”: “Black”}, {“sortOrder”: 2, “id”: 169, “name”:”White”}], “sortOrder”: 1, “id”: 76, “value”: {“sortOrder”: 1, “id”: 168, “name”: “Zwart”}, “createdAt”: “2014-11-06T11:33:32+01:00”, “updatedAt”: “2014-11-06T11:33:32+01:00”, “name”: “Color”}, {“values”: [{“sortOrder”: 1, “id”: 170, “name”: “S” }, {“sortOrder”: 2, “id”: 171, “name”: “M”}, {“sortOrder”: 3, “id”: 172, “name”: “L”}], “sortOrder”: 2, “id”: 77, “value”: {“sortOrder”: 1, “id”: 170, “name”: “S”}, “createdAt”: “2018-11-06T11:33:32+01:00”, “updatedAt”: “2018-11-06T11:33:32+01:00”, “name”: “Size”}]} |
tax | Unique identifier for the tax. {“tax”: “taxes/1”} |
product | Unique identifier for the product. {“product”:1} |
image | Attach an image to a variant. {“variant”: {“title”: “Test”, “image”: {“attachment”: “R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=”, “filename”: “test.jpg”}, “product”: 4 }} |
PUT Update a variant
Update an existing variant based on the given parameters.
Definition
PUT /variants/{variant_id}.json
Example request
curl -X PUT https://api.shoplightspeed.com/en/variants/{variant_id}.json \
-u {key}:{secret} \
-d variant[isDefault]=true \
-d variant[sortOrder]=1 \
-d variant[articleCode]="" \
-d variant[ean]="" \
-d variant[sku]="" \
-d variant[hs]="" \
-d variant[priceExcl]=0 \
-d variant[priceIncl]=0 \
-d variant[priceCost]=0 \
-d variant[oldPriceExcl ]=0 \
-d variant[oldPriceIncl]=0 \
-d variant[stockTracking]="disabled" \
-d variant[stockLevel]=100 \
-d variant[stockAlert]=0 \
-d variant[stockMinimum]=0 \
-d variant[stockSold]=0 \
-d variant[stockBuyMinimum]=1 \
-d variant[stockBuyMaximum]=10000 \
-d variant[weight]=0 \
-d variant[volume]=0 \
-d variant[colli]=1 \
-d variant[sizeX]=0 \
-d variant[sizeY]=0 \
-d variant[sizeZ]=0 \
-d variant[title]="Default" \
-d variant[tax]=18213 \
-d variant[product]=2301083 \
-d image[attachment]="R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=" \
-d image[filename]="test.jpg"
<?php $api->variants->update($variant_id, [
"isDefault" => true,
"sortOrder" => 1,
"articleCode" => "",
"ean" => "",
"sku" => "",
"hs" => "",
"priceExcl" => 0,
"priceIncl" => 0,
"priceCost" => 0,
"oldPriceExcl" => 0,
"oldPriceIncl" => 0,
"stockTracking" => "disabled",
"stockLevel" => 100,
"stockAlert" => 0,
"stockMinimum" => 0,
"stockSold" => 0,
"stockBuyMinimum" => 1,
"stockBuyMaximum" => 10000,
"weight" => 0,
"volume" => 0,
"colli" => 1,
"sizeX" => 0,
"sizeY" => 0,
"sizeZ" => 0,
"title" => "Default",
"tax" => 18213,
"product" => 2301083,
"image" => [
"attachment" => "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="
"filename" => "test.jpg"
]
]);
Example Json payload
{
"variant": {
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": "",
"priceExcl": 0,
"priceIncl": 0,
"priceCost": 0,
"oldPriceExcl": 0,
"oldPriceIncl": 0,
"stockTracking": "disabled",
"stockLevel": 100,
"stockAlert": 0,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 0,
"volume": 0,
"colli": 1,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"title": "Default",
"tax": 18213,
"product": 2301083
}
}
Example response
"variant": {
"id": 196847073,
"createdAt": "2019-08-01T21:49:54+02:00",
"updatedAt": "2019-08-01T21:49:54+02:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": "",
"unitPrice": 0,
"unitUnit": null,
"priceExcl": 0,
"priceIncl": 0,
"priceCost": 0,
"oldPriceExcl": 0,
"oldPriceIncl": 0,
"stockTracking": "disabled",
"stockLevel": 100,
"stockAlert": 0,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 0,
"weightValue": "0.000",
"weightUnit": "g",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 1,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default2",
"taxType": null,
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 2301083,
"url": "products/2301083",
"link": "https://api.shoplightspeed.com/us/products/2301083.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=196847073",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=196847073"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/196847073/metafields",
"link": "https://api.shoplightspeed.com/us/variants/196847073/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": false,
"url": "additionalcosts/",
"link": "https://api.shoplightspeed.com/us/additionalcosts/.json"
}
},
"options": []
}
}
Arguments
isDefault | If the variant is the default (format: boolean){“isDefault”: “true|false”} |
sortOrder | The order of the variant. {“sortOrder”:1} |
articleCode | Merchant specific article code. {“articleCode”: “AB00000123”} |
ean | EAN (bar) code. {“ean”: “AB00000123”} |
sku | Stock keeping unit. {“sku”: “AB00000123”} |
hs | Harmonized System, used for customs. {“hs”: “123456”} |
priceExcl | Price excluding tax. {“priceExcl”:1} |
priceIncl | Price including tax. {“priceIncl”:1.21} |
priceCost | Cost price of variant (for internal use only). {“priceCost”:0.25} |
oldPriceExcl | Old price excluding tax (to show discounted price in the shop). {“oldPriceExcl”:1} |
oldPriceIncl | Old price including tax (to show discounted price in the shop). {“oldPriceIncl”:1.21} |
stockTracking | Track stock (disabled = no tracking; enabled = tracking, disallow backorders; indicator = tracking, allow backorders). {“stockTracking”: “disabled|enabled|indicator”} |
stockLevel | Actual stock level. {“stockLevel”:100} |
stockAlert | Alert stock level below threshold. {“stockAlert”:0} |
stockMinimum | Preferred minimum stockLevel. {“stockMinimum”:0} |
stockSold | Amount of stock sold. {“stockSold”:0 |
stockBuyMinimum | Minimum order amount. {“stockBuyMinimum”:1} |
stockBuyMaximum | Maximum order amount. {“stockBuyMaximum”:10000} |
weight | Weight of variant in grams. {“weight”:250} |
weightValue | Weight when not in grams or when decimals are needed. {“weightValue”:250.25} |
weightUnit | Weight unit when not in grams or conversion into grams is needed. Gram is standard. {“weightUnit”: “g|kg|oz|lb”} |
volume | Volume of variant (ml). {“volume”:25} |
volumeValue | Volume when not in ml. {“volumeValue”:153.55} |
volumeUnit | Volume unit when not in ml or conversion into ml is needed. {“volumeUnit”: “fl_oz”} |
colli | Amount of colli. {“colli”:1} |
sizeX | Width in cm. {“sizeX”:10} |
sizeY | Height in cm. {“sizeY”:5} |
sizeZ | Length in cm. {“sizeZ”:3} |
sizeXValue | Width when not in cm or decimals are needed. {“sizeXValue”:33.78} |
sizeYValue | Height when not in cm or decimals are needed. {“sizeYValue”:76.32} |
sizeZValue | Length when not in cm or decimals are needed. {“sizeZValue”:5.7} |
sizeUnit | Size unit when not in cm or conversion into cm is needed. {“sizeUnit”: “in”} |
matrix | The matrix the variant relates to. {“matrix”: “A”} |
taxType | The type of tax. {“taxType”: “auto|electronic_service”} What are electronically supplied services? Services which are delivered over the Internet or an electronic network and the nature of which renders their supply essentially automated and involving minimal human intervention, and impossible to ensure in the absence of information technology. Check the list |
title | Variant title {“title”: “Size M”} |
unitPrice | To set a unit price. (type: Float) {“unitPrice”:9.8} |
unitUnit | Unit for the price per unit. Must be in following list: ‘Centimeter’, ‘Decimeter’, ‘Foot’, ‘Hectometer’, ‘Inch’, ‘Kilometer’, ‘Meter’, ‘Micrometer’, ‘Mile’, ‘Millimeter’, ‘Yard’, ‘Acre’, ‘Are’, ‘Hectares’, ‘Square centimeter’, ‘Square feet’, ‘Square inch’, ‘Square kilometer’, ‘Square meter’, ‘Square mile’, ‘Square millimeter’, ‘Square yard’, ‘Carat’, ‘Gram’, ‘Kilogram’, ‘Milligram’, ‘Ounce’, ‘Pound’, ‘Stone’, ‘Ton’, ‘Tones’, ‘Cubic centiliter’, ‘Cubic centimeter’, ‘Cubic decimeter’, ‘Cubic decameter’, ‘Cubic feet’, ‘Cubic inch’, ‘Cubic meter’, ‘Cubic millimeter’, ‘Cubic Yard’, ‘Deciliter’, ‘Gallon’, ‘Liter’, ‘Milliliter’, ‘Piece’, ‘Pair’, ‘Capsule’, ‘Tablet’ (type: String) {“unitUnit”: “Meter”} |
options | {“options”: [{“values”:[{“sortOrder”: 1, “id”: 168, “name”: “Black”}, {“sortOrder”: 2, “id”: 169, “name”:”White”}], “sortOrder”: 1, “id”: 76, “value”: {“sortOrder”: 1, “id”: 168, “name”: “Zwart”}, “createdAt”: “2014-11-06T11:33:32+01:00”, “updatedAt”: “2014-11-06T11:33:32+01:00”, “name”: “Color”}, {“values”: [{“sortOrder”: 1, “id”: 170, “name”: “S” }, {“sortOrder”: 2, “id”: 171, “name”: “M”}, {“sortOrder”: 3, “id”: 172, “name”: “L”}], “sortOrder”: 2, “id”: 77, “value”: {“sortOrder”: 1, “id”: 170, “name”: “S”}, “createdAt”: “2018-11-06T11:33:32+01:00”, “updatedAt”: “2018-11-06T11:33:32+01:00”, “name”: “Size”}]} |
tax | Unique identifier for the tax. {“tax”: “taxes/1”} |
image | Attach an image to a variant. The base64 encoded version. {“variant”: {“image”: {“attachment”: “R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=”, “filename”: “test.jpg”}}} |
PUT Update in bulk
Update an existing variant based on the given parameters. Via the variantBulk function, you can update a maximum of 100 variants per call.
Definition
PUT /variants/bulk.json
Example request
curl -X PUT https://api.shoplightspeed.com/en/variants/bulk.json \
-u {key}:{secret} \
-d variant[0][id]=1 \
-d variant[0][stockLevel]=10 \
-d variant[0][priceIncl]=100 \
-d variant[0][priceExcl]=82.6 \
-d variant[0][oldPriceIncl]=110 \
-d variant[0][oldPriceExcl]=90.86 \
-d variant[0][priceCost]=95 \
-d variant[1][id]=2 \
-d variant[1][stockLevel]=4 \
-d variant[1][priceIncl]=50 \
-d variant[1][priceExcl]=41.3 \
-d variant[1][oldPriceIncl]=55 \
-d variant[1][oldPriceExcl]=45.43 \
-d variant[1][priceCost]=39
<?php $api->variantsBulk->update(
[
[
"id" => 1,
"stockLevel" => 10,
"priceIncl" => 100,
"priceExcl" => 82.6,
"oldPriceIncl" => 110,
"oldPriceExcl" => 90.86,
"priceCost" => 95
],
[
"id" => 2,
"stockLevel" => 4,
"priceIncl" => 50,
"priceExcl" => 41.3,
"oldPriceIncl" => 55,
"oldPriceExcl" => 45.43,
"priceCost" => 39
]
]
);
Example Json payload
{
"variant": [
{
"id" : 1,
"stockLevel" : 10,
"priceIncl" : 100,
"priceExcl" : 82.6,
"oldPriceIncl" : 110,
"oldPriceExcl" : 90.86,
"priceCost" : 95
},
{
"id" : 2,
"stockLevel" : 4,
"priceIncl" : 50,
"priceExcl" : 41.3,
"oldPriceIncl" : 55,
"oldPriceExcl" : 45.43,
"priceCost" : 39
}
]
}
Example response
{
"variants": [
{
"id": 196847073,
"createdAt": "2019-08-01T21:49:54+02:00",
"updatedAt": "2019-08-02T21:27:48+02:00",
"isDefault": true,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": "",
"unitPrice": 0,
"unitUnit": null,
"priceExcl": 82.6446,
"priceIncl": 100,
"priceCost": 95,
"oldPriceExcl": 90.9091,
"oldPriceIncl": 110,
"stockTracking": "disabled",
"stockLevel": 10,
"stockAlert": 0,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 0,
"weightValue": "0.000",
"weightUnit": "g",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 1,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default2",
"taxType": null,
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 94440643,
"url": "products/94440643",
"link": "https://api.shoplightspeed.com/us/products/94440643.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=196847073",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=196847073"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/196847073/metafields",
"link": "https://api.shoplightspeed.com/us/variants/196847073/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": false,
"url": "additionalcosts/",
"link": "https://api.shoplightspeed.com/us/additionalcosts/.json"
}
},
"options": []
},
{
"id": 188992150,
"createdAt": "2019-05-31T20:49:33+02:00",
"updatedAt": "2019-08-02T21:27:48+02:00",
"isDefault": false,
"sortOrder": 1,
"articleCode": "",
"ean": "",
"sku": "",
"hs": null,
"unitPrice": 10,
"unitUnit": "Foot",
"priceExcl": 41.3223,
"priceIncl": 50,
"priceCost": 39,
"oldPriceExcl": 45.4545,
"oldPriceIncl": 55,
"stockTracking": "indicator",
"stockLevel": 4,
"stockAlert": 5,
"stockMinimum": 0,
"stockSold": 0,
"stockBuyMininum": 1,
"stockBuyMinimum": 1,
"stockBuyMaximum": 10000,
"weight": 1000,
"weightValue": "1.000",
"weightUnit": "kg",
"volume": 0,
"volumeValue": 0,
"volumeUnit": "ml",
"colli": 0,
"sizeX": 0,
"sizeY": 0,
"sizeZ": 0,
"sizeXValue": "0.000",
"sizeYValue": "0.000",
"sizeZValue": "0.000",
"sizeUnit": "cm",
"matrix": false,
"title": "Default",
"taxType": "",
"image": false,
"tax": {
"resource": {
"id": 926219,
"url": "taxes/926219",
"link": "https://api.shoplightspeed.com/us/taxes/926219.json"
}
},
"product": {
"resource": {
"id": 94440643,
"url": "products/94440643",
"link": "https://api.shoplightspeed.com/us/products/94440643.json"
}
},
"movements": {
"resource": {
"id": false,
"url": "variants/movements?variant=188992150",
"link": "https://api.shoplightspeed.com/us/variants/movements.json?variant=188992150"
}
},
"metafields": {
"resource": {
"id": false,
"url": "variants/188992150/metafields",
"link": "https://api.shoplightspeed.com/us/variants/188992150/metafields.json"
}
},
"additionalcost": {
"resource": {
"id": 11426,
"url": "additionalcosts/11426",
"link": "https://api.shoplightspeed.com/us/additionalcosts/11426.json"
}
},
"options": []
}
],
"errors": []
}
Arguments
id | The unique numeric identifier for the variant.{“id”: {id}} |
stockLevel | Actual stock level. {“stockLevel”:100} |
priceExcl | Price excluding tax. {“priceExcl”:1} |
priceIncl | Price including tax. {“priceIncl”:1.21} |
oldPriceExcl | Old price excluding tax. (to show discounted price in the shop). {“oldPriceExcl”:1} |
oldPriceIncl | Old price including tax. (to show discounted price in the shop). {“oldPriceIncl”:1.21} |
priceCost | Cost price of variant (for internal use only). {“priceCost”:0.25} |
DELETE Delete a variant
Delete an existing variant based on the unique identifier.
Definition
DELETE /variants/{variant_id}.json
Example request
curl -X DELETE https://api.shoplightspeed.com/en/variants/{variant_id}.json \
-u {key}:{secret}
<?php $api->variants->delete($variant_id);
Example response
HTTP/1.1 204 No Content
Arguments
id | The unique numeric identifier for the variant. {“id”: {id}} |