Cart
The Cart API is used to interact with a cart during a customer's session. This guide shows how to use the Cart API to add, update, and delete cart line items, and update cart notes.
Get the cart
GET /{locale}/api/cart
Use the GET /{locale}/api/cart endpoint to get the cart as JSON.
All monetary properties are returned in the customer's presentment currency. To check the customer's presentment currency, you can use the currency field in the response when you have added other markets.
Below is a simplified GET request using the fetch API. The Content-Type should be set to application/json in the headers object. The response is the JSON of the line items associated.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/cart', {
headers: {
'Content-Type': 'application/json'
}
})
.then((response) => response.json())
.then((data) => {
// do something...
});
Response
- Schema
- Example
cart object
line_items object[]
List of line items.
Array [idstringID of the line item.
item_idstringproduct_idstringID of the product.
variant_idstringID of the variant.
quantitystringQuantity of the item.
notestringNote attached to the line item.
propertiesstringCustom properties of the line item, returned as a JSON string. Parse it before use.
custombooleanWhether the line item is a custom item.
product_titlestringTitle of the product.
product_handlestringHandle of the product.
product_urlstringRelative URL of the product page.
variant_titlestringTitle of the variant, for example
Blue, Size M.product_typestringProduct type.
pricestringPrice of a single unit of the line item.
compare_at_pricestringCompare-at price of the item.
origin_pricestringline_pricestringCombined price of all units in this line item, before discounts.
original_line_pricenumberOriginal price of the line item before discounts.
saved_pricenumberAmount saved on this line item.
final_line_pricestringCombined price of all units in this line item, after line-level discounts.
final_pricestringPrice of a single unit of this line item, after line-level discounts.
discount_applicationsundefined[]Discounts applied to this object.
fixed_discount_totalstringdiscount_totalstringTotal discount applied.
discount_idstringID of the discount applied.
availablebooleanWhether the item can be purchased.
available_quantitynumberQuantity still available for purchase.
can_buybooleanWhether the variant of the line item can be sold.
weightstringWeight of the variant.
weight_unitstringUnit of the weight, for example
kg.skustringSKU of the variant, used for inventory tracking.
spustringSPU of the product.
requires_shippingbooleanWhether shipping is required.
taxablebooleanWhether tax is charged.
image object
Image of the line item's variant.
srcstringURL of the image.
pathstringPath of the image file on the image server.
widthnumberWidth of the image, in pixels.
heightnumberHeight of the image, in pixels.
altstringAlt text of the image.
options object[]
Option values of the line item's variant.
Array [namestringName of the product option, for example
Color.valuestringValue selected for this product option.
]wholesale_price object[]
Wholesale price tiers.
Array [min_quantitynumberMinimum quantity required for this wholesale tier.
pricestringUnit price of this wholesale tier.
]parts_pricestringproduct_tagsundefined[]Tags of the product.
publishedbooleanWhether the resource is published.
published_atstringPublication time, in ISO-8601 format.
inventory_quantitynumberInventory quantity.
inventory_policystringWhether the product keeps selling when it is out of stock.
inventory_trackingbooleanWhether inventory tracking is enabled.
cost_pricestringCost price of the variant.
vendorstringVendor of the product.
vendor_urlstringURL of the product vendor.
barcodestringBarcode of the variant.
mixed_wholesalebooleanWhether mixed wholesale is supported.
tax_codestringretail_pricestringRetail price in the store's main currency unit.
item_textstringdisabledbooleanis_free_giftbooleanWhether the item is a free gift.
custom_discountsundefined[]]ineffectivesundefined[]Line items in the cart that can no longer be purchased.
discount_applicationsundefined[]Discounts applied to this object.
attributesundefined[]total_discountstringTotal amount saved by all discounts on the cart.
discount_line_item_pricestringDiscounted total for the applied discounts.
currencystringCurrency of the cart, for example
USD.original_line_pricestringOriginal price of the line item before discounts.
original_total_pricestringTotal price of the cart before any discounts.
line_pricestringCombined price of all units in this line item, before discounts.
total_pricestringTotal price of the cart after discounts.
notestringNote attached to the object.
created_atstringCreation time, in ISO-8601 format.
updated_atstringLast update time, in ISO-8601 format.
item_countnumberNumber of items in the cart.
total_weightnumberTotal weight of all items in the cart.
invalid_msgstringidentity_cart_idstringIdentifier of the cart. Use it to link a cart to the order it becomes.
user_idstringID of the signed-in customer. Absent for guests.
{
"cart": {
"line_items": [
{
"id": "684953787470717063_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684953787470717063",
"product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
"variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
"quantity": "1",
"note": "",
"properties": "",
"custom": false,
"product_title": "sample-product",
"product_handle": "sample-product",
"product_url": "/products/sample-product",
"variant_title": "01",
"product_type": "default",
"price": "1.00",
"compare_at_price": "1.00",
"origin_price": "1.00",
"line_price": "1.00",
"original_line_price": 1,
"saved_price": 0,
"final_line_price": "1.00",
"final_price": "1.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 999999999,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"width": 3000,
"height": 1500,
"alt": ""
},
"options": [
{
"name": "Size",
"value": "01"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "1.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-08-10T07:28:24Z",
"inventory_quantity": 0,
"inventory_policy": "",
"inventory_tracking": false,
"cost_price": "1.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
}
],
"ineffectives": [],
"discount_applications": [],
"attributes": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"currency": "USD",
"original_line_price": "1.00",
"original_total_price": "1.00",
"line_price": "1.00",
"total_price": "1.00",
"note": "",
"created_at": "2026-09-03T01:03:36Z",
"updated_at": "2026-09-03T02:41:50Z",
"item_count": 1,
"total_weight": 0,
"invalid_msg": "",
"identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
"user_id": "9fe44049-abab-4fed-ab3d-1bf4ffee8ef5"
}
}
Add a variant to the cart
POST /{locale}/api/cart
Use the POST /{locale}/api/cart endpoint to add a single variant to the cart.
Example request
If an item is already in the cart, then quantity is added to the current quantity for that item.
const data = {
product_id: "b1ab6324-ae4f-4cca-907e-18af16839447",
variant_id: "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
quantity: 1,
refer_info: {
source: "add_to_cart"
},
properties: {
Engraving: "Happy Birthday",
_design_id: "dsg_8f21c"
}
};
fetch(window.SHOPLAZZA.routes.root + '/api/cart', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
})
.catch((error) => {
console.error('Error: ', error);
});
Request parameters
- Schema
- Example
The product id of the variant.
The quantity that needs to add to the cart.
The variant id.
refer_info object
The refer info for the source of the request. It has a source property that possible values: add_to_cart, buy_now, or cart.
Custom properties to attach to the line item, such as customization options. They stay on the line item through to the order.
{
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"quantity": 1,
"refer_info": {
"source": "add_to_cart"
},
"properties": {
"Engraving": "Happy Birthday",
"_design_id": "dsg_8f21c"
}
}
A line item is identified by its variant together with its properties. Adding the same variant with different properties creates a second line item instead of increasing the quantity of the first one.
In responses, properties comes back as a JSON string, so parse it before reading keys. A line added without properties comes back as an empty string, so check for a value first and guard against a parsed result that is not a plain object.
A key that starts with an underscore is still returned by this API, but it is never displayed to the shopper or in the admin. For the full flow, from writing properties on the product page to reading them back off the order, see Add custom properties to cart and orders.
Response
- Schema
- Example
- Array [
- Array [
- ]
- Array [
- ]
- ]
Request result flag; success or 0 means the request succeeded.
Result message returned with the response.
List of errors returned when the request fails.
data object
The response payload.
items object[]
List of line items in the cart.
ID of the line item.
ID of the product.
ID of the variant.
Quantity of the item.
Note attached to the line item.
Custom properties of the line item, returned as a JSON string. Parse it before use.
Whether the line item is a custom item.
Title of the product.
Handle of the product.
Relative URL of the product page.
Title of the variant, for example Blue, Size M.
Product type.
Price of a single unit of the line item.
Compare-at price of the item.
Whether the item can be purchased.
Quantity still available for purchase.
Weight of the variant.
Unit of the weight, for example kg.
SKU of the variant, used for inventory tracking.
SPU of the product.
Whether shipping is required.
Whether tax is charged.
image object
Image of the line item's variant.
URL of the image.
Path of the image file on the image server.
Width of the image, in pixels.
Height of the image, in pixels.
Alt text of the image.
options object[]
Option values of the line item's variant.
Name of the product option, for example Color.
Value selected for this product option.
wholesale_price object[]
Wholesale price tiers.
Minimum quantity required for this wholesale tier.
Unit price of this wholesale tier.
Tags of the product.
Whether the resource is published.
Publication time, in ISO-8601 format.
Inventory quantity.
Whether the product keeps selling when it is out of stock.
Whether inventory tracking is enabled.
Cost price of the variant.
Vendor of the product.
URL of the product vendor.
Barcode of the variant.
Whether mixed wholesale is supported.
Retail price in the store's main currency unit.
{
"state": "success",
"message": "",
"errors": [],
"data": {
"items": [
{
"id": "0_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684953787470717063",
"product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
"variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
"quantity": 1,
"note": "",
"properties": "",
"custom": false,
"product_title": "sample-product",
"product_handle": "sample-product",
"product_url": "/products/sample-product",
"variant_title": "01",
"product_type": "default",
"price": "1.00",
"compare_at_price": "1.00",
"origin_price": "1.00",
"available": true,
"available_quantity": 999999999,
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"width": 3000,
"height": 1500,
"alt": ""
},
"options": [
{
"name": "Size",
"value": "01"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "1.00"
}
],
"product_tags": [],
"published": true,
"published_at": "2026-08-10T07:28:24Z",
"inventory_quantity": 0,
"inventory_policy": "",
"inventory_tracking": false,
"cost_price": "1.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"add_quantity": "1",
"disabled": false
}
]
}
}
Add one or more variants to the cart
POST /{locale}/api/cart/batch
Use the POST /{locale}/api/cart/batch endpoint to add one or multiple variants to the cart.
Example request
If an item is already in the cart, then quantity is added to the current quantity for that item.
const data = {
line_items: [
{
product_id: "b1ab6324-ae4f-4cca-907e-18af16839447",
variant_id: "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
quantity: 1,
properties: {
Engraving: "Happy Birthday"
}
},
{
quantity: 2,
product_id: "588ed0ce-40af-44c7-8dea-afa18b489ef8",
variant_id: "83196e5a-b25f-42c3-8df5-359d83ea7ae8"
}
]
}
fetch(window.SHOPLAZZA.routes.root + '/api/cart/batch', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
})
.catch((error) => {
console.error('Error: ', error);
});
Request parameters
- Schema
- Example
- Array [
- ]
line_items object[]
List of line items.
ID of the product to add.
ID of the variant to add.
Quantity to add.
Custom properties to attach to the line item.
{
"line_items": [
{
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"quantity": 1,
"properties": {
"Engraving": "Happy Birthday"
}
},
{
"quantity": 2,
"product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
"variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8"
}
]
}
Response
- Schema
- Example
- Array [
- Array [
- ]
- Array [
- ]
- ]
items object[]
List of line items in the cart.
ID of the line item.
ID of the product.
ID of the variant.
Quantity of the item.
Note attached to the line item.
Custom properties captured on the line item.
Whether the line item is a custom item.
Title of the product.
Handle of the product.
Relative URL of the product page.
Title of the variant, for example Blue, Size M.
Product type.
Price of a single unit of the line item.
Compare-at price of the item.
Whether the item can be purchased.
Quantity still available for purchase.
Weight of the variant.
Unit of the weight, for example kg.
SKU of the variant, used for inventory tracking.
SPU of the product.
Whether shipping is required.
Whether tax is charged.
image object
Image of the line item's variant.
URL of the image.
Path of the image file on the image server.
Width of the image, in pixels.
Height of the image, in pixels.
Alt text of the image.
options object[]
Option values of the line item's variant.
Name of the product option, for example Color.
Value selected for this product option.
wholesale_price object[]
Wholesale price tiers.
Minimum quantity required for this wholesale tier.
Unit price of this wholesale tier.
Tags of the product.
Whether the resource is published.
Publication time, in ISO-8601 format.
Inventory quantity.
Whether the product keeps selling when it is out of stock.
Whether inventory tracking is enabled.
Cost price of the variant.
Vendor of the product.
URL of the product vendor.
Barcode of the variant.
Whether mixed wholesale is supported.
Retail price in the store's main currency unit.
{
"items": [
{
"id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684765446766863303",
"product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
"variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
"quantity": 2,
"note": "",
"properties": "",
"custom": false,
"product_title": "sample-product",
"product_handle": "sample-product",
"product_url": "/products/sample-product",
"variant_title": "01",
"product_type": "default",
"price": "1.00",
"compare_at_price": "1.00",
"origin_price": "1.00",
"available": true,
"available_quantity": 999999999,
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"width": 3000,
"height": 1500,
"alt": ""
},
"options": [
{
"name": "Size",
"value": "01"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "1.00"
}
],
"product_tags": [],
"published": true,
"published_at": "2026-08-10T07:28:24Z",
"inventory_quantity": 0,
"inventory_policy": "",
"inventory_tracking": false,
"cost_price": "1.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"add_quantity": "1",
"disabled": false
}
]
}
Set the quantity of several line items
POST /{locale}/api/cart/update
Use the POST /{locale}/api/cart/update endpoint to set the quantity of one or more line items that are already in the cart. Unlike POST /{locale}/api/cart, the quantity you send replaces the current quantity instead of being added to it.
Example request
const data = {
line_items: [
{
product_id: "b1ab6324-ae4f-4cca-907e-18af16839447",
variant_id: "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
quantity: 1
}
]
};
fetch(window.SHOPLAZZA.routes.root + '/api/cart/update', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
});
Request parameters
- Schema
- Example
- Array [
- ]
line_items object[]
The line items to update.
The product id of the variant.
The variant id.
The new quantity of the line item.
{
"line_items": [
{
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"quantity": 1
}
]
}
Response
- Schema
- Example
cart object
line_items object[]
List of line items.
Array [idstringID of the line item.
item_idstringproduct_idstringID of the product.
variant_idstringID of the variant.
quantitystringQuantity of the item.
notestringNote attached to the line item.
propertiesstringCustom properties captured on the line item.
custombooleanWhether the line item is a custom item.
product_titlestringTitle of the product.
product_handlestringHandle of the product.
product_urlstringRelative URL of the product page.
variant_titlestringTitle of the variant, for example
Blue, Size M.product_typestringProduct type.
pricestringPrice of a single unit of the line item.
compare_at_pricestringCompare-at price of the item.
origin_pricestringline_pricestringCombined price of all units in this line item, before discounts.
original_line_pricenumberOriginal price of the line item before discounts.
saved_pricenumberAmount saved on this line item.
final_line_pricestringCombined price of all units in this line item, after line-level discounts.
final_pricestringPrice of a single unit of this line item, after line-level discounts.
discount_applicationsundefined[]Discounts applied to this object.
fixed_discount_totalstringdiscount_totalstringTotal discount applied.
discount_idstringID of the discount applied.
availablebooleanWhether the item can be purchased.
available_quantitynumberQuantity still available for purchase.
can_buybooleanWhether the variant of the line item can be sold.
weightstringWeight of the variant.
weight_unitstringUnit of the weight, for example
kg.skustringSKU of the variant, used for inventory tracking.
spustringSPU of the product.
requires_shippingbooleanWhether shipping is required.
taxablebooleanWhether tax is charged.
image object
Image of the line item's variant.
srcstringURL of the image.
pathstringPath of the image file on the image server.
widthnumberWidth of the image, in pixels.
heightnumberHeight of the image, in pixels.
altstringAlt text of the image.
options object[]
Option values of the line item's variant.
Array [namestringName of the product option, for example
Color.valuestringValue selected for this product option.
]wholesale_price object[]
Wholesale price tiers.
Array [min_quantitynumberMinimum quantity required for this wholesale tier.
pricestringUnit price of this wholesale tier.
]parts_pricestringproduct_tagsundefined[]Tags of the product.
publishedbooleanWhether the resource is published.
published_atstringPublication time, in ISO-8601 format.
inventory_quantitynumberInventory quantity.
inventory_policystringWhether the product keeps selling when it is out of stock.
inventory_trackingbooleanWhether inventory tracking is enabled.
cost_pricestringCost price of the variant.
vendorstringVendor of the product.
vendor_urlstringURL of the product vendor.
barcodestringBarcode of the variant.
mixed_wholesalebooleanWhether mixed wholesale is supported.
tax_codestringretail_pricestringRetail price in the store's main currency unit.
item_textstringdisabledbooleanis_free_giftbooleanWhether the item is a free gift.
custom_discountsundefined[]]ineffectivesundefined[]Line items in the cart that can no longer be purchased.
discount_applicationsundefined[]Discounts applied to this object.
attributesundefined[]total_discountstringTotal amount saved by all discounts on the cart.
discount_line_item_pricestringDiscounted total for the applied discounts.
currencystringCurrency of the cart, for example
USD.original_line_pricestringOriginal price of the line item before discounts.
original_total_pricestringTotal price of the cart before any discounts.
line_pricestringCombined price of all units in this line item, before discounts.
total_pricestringTotal price of the cart after discounts.
notestringNote attached to the object.
created_atstringCreation time, in ISO-8601 format.
updated_atstringLast update time, in ISO-8601 format.
item_countnumberNumber of items in the cart.
total_weightnumberTotal weight of all items in the cart.
invalid_msgstringidentity_cart_idstringIdentifier of the cart. Use it to link a cart to the order it becomes.
user_idstring
{
"cart": {
"line_items": [
{
"id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684765446766863303",
"product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
"variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
"quantity": "1",
"note": "",
"properties": "",
"custom": false,
"product_title": "sample-product",
"product_handle": "sample-product",
"product_url": "/products/sample-product",
"variant_title": "01",
"product_type": "default",
"price": "1.00",
"compare_at_price": "1.00",
"origin_price": "1.00",
"line_price": "1.00",
"original_line_price": 1,
"saved_price": 0,
"final_line_price": "1.00",
"final_price": "1.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 999999999,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"width": 3000,
"height": 1500,
"alt": ""
},
"options": [
{
"name": "Size",
"value": "01"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "1.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-08-10T07:28:24Z",
"inventory_quantity": 0,
"inventory_policy": "",
"inventory_tracking": false,
"cost_price": "1.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
},
{
"id": "684698318307074183_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684698318307074183",
"product_id": "b3b656ae-504f-4f01-a054-879a610925e3",
"variant_id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"quantity": "2",
"note": "",
"properties": "",
"custom": false,
"product_title": "Sample product",
"product_handle": "Sample product",
"product_url": "/products/Sample product",
"variant_title": "Black-S",
"product_type": "default",
"price": "10.00",
"compare_at_price": "20.00",
"origin_price": "10.00",
"line_price": "20.00",
"original_line_price": 40,
"saved_price": 10,
"final_line_price": "20.00",
"final_price": "10.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 48,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "1111-BLACK-S-A001001",
"spu": "1111",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "10.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-07-30T02:28:23Z",
"inventory_quantity": 48,
"inventory_policy": "deny",
"inventory_tracking": true,
"cost_price": "10.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
}
],
"ineffectives": [],
"discount_applications": [],
"attributes": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"currency": "USD",
"original_line_price": "41.00",
"original_total_price": "41.00",
"line_price": "21.00",
"total_price": "21.00",
"note": "",
"created_at": "2026-06-23T19:57:16Z",
"updated_at": "2026-09-02T14:13:29Z",
"item_count": 3,
"total_weight": 0,
"invalid_msg": "",
"identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
"user_id": ""
}
}
Set the quantity of one line item
PATCH /{locale}/api/cart/{variant_id}
Use the PATCH /{locale}/api/cart/{variant_id} endpoint to update the cart's line item quantities.
Example request
If an item is already in the cart, then quantity is equal to the new quantity quantity for that item.
const data = {
id: "298422_d41d8cd98f00b204e9800998ecf8427e",
product_id: "588ed0ce-40af-44c7-8dea-afa18b489ef8",
variant_id: "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
quantity: 3,
properties: {
Engraving: "Happy Anniversary"
}
};
fetch(window.SHOPLAZZA.routes.root + '/api/cart/83196e5a-b25f-42c3-8df5-359d83ea7ae8', {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
})
.catch((error) => {
console.error('Error: ', error);
});
Request parameters
- Schema
- Example
ID of the variant. Send it in the path and in the request body.
ID of the line item to update, taken from the id of a line item in the cart.
ID of the product.
Quantity of the item.
Custom properties of the line item. What you send replaces the properties the line item already has.
{
"id": "298422_d41d8cd98f00b204e9800998ecf8427e",
"product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
"variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
"quantity": 3,
"properties": {
"Engraving": "Happy Anniversary"
}
}
Response
- Schema
- Example
cart object
line_items object[]
List of line items.
Array [idstringID of the line item.
item_idstringproduct_idstringID of the product.
variant_idstringID of the variant.
quantitystringQuantity of the item.
notestringNote attached to the line item.
propertiesstringCustom properties captured on the line item.
custombooleanWhether the line item is a custom item.
product_titlestringTitle of the product.
product_handlestringHandle of the product.
product_urlstringRelative URL of the product page.
variant_titlestringTitle of the variant, for example
Blue, Size M.product_typestringProduct type.
pricestringPrice of a single unit of the line item.
compare_at_pricestringCompare-at price of the item.
origin_pricestringline_pricestringCombined price of all units in this line item, before discounts.
original_line_pricenumberOriginal price of the line item before discounts.
saved_pricenumberAmount saved on this line item.
final_line_pricestringCombined price of all units in this line item, after line-level discounts.
final_pricestringPrice of a single unit of this line item, after line-level discounts.
discount_applicationsundefined[]Discounts applied to this object.
fixed_discount_totalstringdiscount_totalstringTotal discount applied.
discount_idstringID of the discount applied.
availablebooleanWhether the item can be purchased.
available_quantitynumberQuantity still available for purchase.
can_buybooleanWhether the variant of the line item can be sold.
weightstringWeight of the variant.
weight_unitstringUnit of the weight, for example
kg.skustringSKU of the variant, used for inventory tracking.
spustringSPU of the product.
requires_shippingbooleanWhether shipping is required.
taxablebooleanWhether tax is charged.
image object
Image of the line item's variant.
srcstringURL of the image.
pathstringPath of the image file on the image server.
widthnumberWidth of the image, in pixels.
heightnumberHeight of the image, in pixels.
altstringAlt text of the image.
options object[]
Option values of the line item's variant.
Array [namestringName of the product option, for example
Color.valuestringValue selected for this product option.
]wholesale_price object[]
Wholesale price tiers.
Array [min_quantitynumberMinimum quantity required for this wholesale tier.
pricestringUnit price of this wholesale tier.
]parts_pricestringproduct_tagsundefined[]Tags of the product.
publishedbooleanWhether the resource is published.
published_atstringPublication time, in ISO-8601 format.
inventory_quantitynumberInventory quantity.
inventory_policystringWhether the product keeps selling when it is out of stock.
inventory_trackingbooleanWhether inventory tracking is enabled.
cost_pricestringCost price of the variant.
vendorstringVendor of the product.
vendor_urlstringURL of the product vendor.
barcodestringBarcode of the variant.
mixed_wholesalebooleanWhether mixed wholesale is supported.
tax_codestringretail_pricestringRetail price in the store's main currency unit.
item_textstringdisabledbooleanis_free_giftbooleanWhether the item is a free gift.
custom_discountsundefined[]]ineffectivesundefined[]Line items in the cart that can no longer be purchased.
discount_applicationsundefined[]Discounts applied to this object.
attributesundefined[]total_discountstringTotal amount saved by all discounts on the cart.
discount_line_item_pricestringDiscounted total for the applied discounts.
currencystringCurrency of the cart, for example
USD.original_line_pricestringOriginal price of the line item before discounts.
original_total_pricestringTotal price of the cart before any discounts.
line_pricestringCombined price of all units in this line item, before discounts.
total_pricestringTotal price of the cart after discounts.
notestringNote attached to the object.
created_atstringCreation time, in ISO-8601 format.
updated_atstringLast update time, in ISO-8601 format.
item_countnumberNumber of items in the cart.
total_weightnumberTotal weight of all items in the cart.
invalid_msgstringidentity_cart_idstringIdentifier of the cart. Use it to link a cart to the order it becomes.
user_idstring
{
"cart": {
"line_items": [
{
"id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684765446766863303",
"product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
"variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
"quantity": "2",
"note": "",
"properties": "",
"custom": false,
"product_title": "sample-product",
"product_handle": "sample-product",
"product_url": "/products/sample-product",
"variant_title": "01",
"product_type": "default",
"price": "1.00",
"compare_at_price": "1.00",
"origin_price": "1.00",
"line_price": "2.00",
"original_line_price": 2,
"saved_price": 0,
"final_line_price": "2.00",
"final_price": "1.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 999999999,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"width": 3000,
"height": 1500,
"alt": ""
},
"options": [
{
"name": "Size",
"value": "01"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "1.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-08-10T07:28:24Z",
"inventory_quantity": 0,
"inventory_policy": "",
"inventory_tracking": false,
"cost_price": "1.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
},
{
"id": "684698318307074183_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684698318307074183",
"product_id": "b3b656ae-504f-4f01-a054-879a610925e3",
"variant_id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"quantity": "2",
"note": "",
"properties": "",
"custom": false,
"product_title": "Sample product",
"product_handle": "Sample product",
"product_url": "/products/Sample product",
"variant_title": "Black-S",
"product_type": "default",
"price": "10.00",
"compare_at_price": "20.00",
"origin_price": "10.00",
"line_price": "20.00",
"original_line_price": 40,
"saved_price": 10,
"final_line_price": "20.00",
"final_price": "10.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 48,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "1111-BLACK-S-A001001",
"spu": "1111",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "10.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-07-30T02:28:23Z",
"inventory_quantity": 48,
"inventory_policy": "deny",
"inventory_tracking": true,
"cost_price": "10.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
}
],
"ineffectives": [],
"discount_applications": [],
"attributes": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"currency": "USD",
"original_line_price": "42.00",
"original_total_price": "42.00",
"line_price": "22.00",
"total_price": "22.00",
"note": "",
"created_at": "2026-06-23T19:57:16Z",
"updated_at": "2026-09-02T14:13:27Z",
"item_count": 4,
"total_weight": 0,
"invalid_msg": "",
"identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
"user_id": ""
}
}
Remove a line item from the cart
DELETE /{locale}/api/cart/{variant_id}
Use the DELETE /{locale}/api/cart/{variant_id} endpoint to remove a line item.
Example request
const data = {
id: "298422_d41d8cd98f00b204e9800998ecf8427e",
product_id: "588ed0ce-40af-44c7-8dea-afa18b489ef8",
variant_id: "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
};
fetch(window.SHOPLAZZA.routes.root + '/api/cart/83196e5a-b25f-42c3-8df5-359d83ea7ae8', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
})
.catch((error) => {
console.error('Error: ', error);
});
Request parameters
- Schema
- Example
ID of the variant. Send it in the path and in the request body.
ID of the line item to remove, taken from the id of a line item in the cart.
ID of the product.
{
"id": "298422_d41d8cd98f00b204e9800998ecf8427e",
"product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
"variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8"
}
Response
- Schema
- Example
cart object
line_itemsundefined[]List of line items.
ineffectivesundefined[]Line items in the cart that can no longer be purchased.
discount_applicationsundefined[]Discounts applied to this object.
attributesundefined[]total_discountstringTotal amount saved by all discounts on the cart.
discount_line_item_pricestringDiscounted total for the applied discounts.
currencystringCurrency of the cart, for example
USD.original_line_pricestringOriginal price of the line item before discounts.
original_total_pricestringTotal price of the cart before any discounts.
line_pricestringCombined price of all units in this line item, before discounts.
total_pricestringTotal price of the cart after discounts.
notestringNote attached to the object.
created_atstringCreation time, in ISO-8601 format.
updated_atstringLast update time, in ISO-8601 format.
item_countnumberNumber of items in the cart.
total_weightnumberTotal weight of all items in the cart.
invalid_msgstringidentity_cart_idstringIdentifier of the cart. Use it to link a cart to the order it becomes.
user_idstring
{
"cart": {
"line_items": [],
"ineffectives": [],
"discount_applications": [],
"attributes": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"currency": "USD",
"original_line_price": "0.00",
"original_total_price": "0.00",
"line_price": "0.00",
"total_price": "0.00",
"note": "",
"created_at": "2026-09-03T01:03:36Z",
"updated_at": "2026-09-03T02:41:51Z",
"item_count": 0,
"total_weight": 0,
"invalid_msg": "",
"identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
"user_id": "9fe44049-abab-4fed-ab3d-1bf4ffee8ef5"
}
}
Select which line items are checked out
POST /{locale}/api/cart/cart-select
Use the POST /{locale}/api/cart/cart-select endpoint to choose which line items of the cart are selected for checkout. Line items that are not in selected_cart_ids become unselected.
Example request
const data = {
selected_cart_ids: ["684765446766863303_d41d8cd98f00b204e9800998ecf8427e"]
};
fetch(window.SHOPLAZZA.routes.root + '/api/cart/cart-select', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
});
Request parameters
- Schema
- Example
The ids of the line items to select, as returned in id.
{
"selected_cart_ids": [
"684765446766863303_d41d8cd98f00b204e9800998ecf8427e"
]
}
Response
- Schema
- Example
cart object
line_items object[]
List of line items.
Array [idstringID of the line item.
item_idstringproduct_idstringID of the product.
variant_idstringID of the variant.
quantitystringQuantity of the item.
notestringNote attached to the line item.
propertiesstringCustom properties captured on the line item.
custombooleanWhether the line item is a custom item.
product_titlestringTitle of the product.
product_handlestringHandle of the product.
product_urlstringRelative URL of the product page.
variant_titlestringTitle of the variant, for example
Blue, Size M.product_typestringProduct type.
pricestringPrice of a single unit of the line item.
compare_at_pricestringCompare-at price of the item.
origin_pricestringline_pricestringCombined price of all units in this line item, before discounts.
original_line_pricenumberOriginal price of the line item before discounts.
saved_pricenumberAmount saved on this line item.
final_line_pricestringCombined price of all units in this line item, after line-level discounts.
final_pricestringPrice of a single unit of this line item, after line-level discounts.
discount_applicationsundefined[]Discounts applied to this object.
fixed_discount_totalstringdiscount_totalstringTotal discount applied.
discount_idstringID of the discount applied.
availablebooleanWhether the item can be purchased.
available_quantitynumberQuantity still available for purchase.
can_buybooleanWhether the variant of the line item can be sold.
weightstringWeight of the variant.
weight_unitstringUnit of the weight, for example
kg.skustringSKU of the variant, used for inventory tracking.
spustringSPU of the product.
requires_shippingbooleanWhether shipping is required.
taxablebooleanWhether tax is charged.
image object
Image of the line item's variant.
srcstringURL of the image.
pathstringPath of the image file on the image server.
widthnumberWidth of the image, in pixels.
heightnumberHeight of the image, in pixels.
altstringAlt text of the image.
options object[]
Option values of the line item's variant.
Array [namestringName of the product option, for example
Color.valuestringValue selected for this product option.
]wholesale_price object[]
Wholesale price tiers.
Array [min_quantitynumberMinimum quantity required for this wholesale tier.
pricestringUnit price of this wholesale tier.
]parts_pricestringproduct_tagsundefined[]Tags of the product.
publishedbooleanWhether the resource is published.
published_atstringPublication time, in ISO-8601 format.
inventory_quantitynumberInventory quantity.
inventory_policystringWhether the product keeps selling when it is out of stock.
inventory_trackingbooleanWhether inventory tracking is enabled.
cost_pricestringCost price of the variant.
vendorstringVendor of the product.
vendor_urlstringURL of the product vendor.
barcodestringBarcode of the variant.
mixed_wholesalebooleanWhether mixed wholesale is supported.
tax_codestringretail_pricestringRetail price in the store's main currency unit.
item_textstringdisabledbooleanis_free_giftbooleanWhether the item is a free gift.
custom_discountsundefined[]]ineffectivesundefined[]Line items in the cart that can no longer be purchased.
discount_applicationsundefined[]Discounts applied to this object.
attributesundefined[]total_discountstringTotal amount saved by all discounts on the cart.
discount_line_item_pricestringDiscounted total for the applied discounts.
currencystringCurrency of the cart, for example
USD.original_line_pricestringOriginal price of the line item before discounts.
original_total_pricestringTotal price of the cart before any discounts.
line_pricestringCombined price of all units in this line item, before discounts.
total_pricestringTotal price of the cart after discounts.
notestringNote attached to the object.
created_atstringCreation time, in ISO-8601 format.
updated_atstringLast update time, in ISO-8601 format.
item_countnumberNumber of items in the cart.
total_weightnumberTotal weight of all items in the cart.
invalid_msgstringidentity_cart_idstringIdentifier of the cart. Use it to link a cart to the order it becomes.
user_idstring
{
"cart": {
"line_items": [
{
"id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684765446766863303",
"product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
"variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
"quantity": "2",
"note": "",
"properties": "",
"custom": false,
"product_title": "sample-product",
"product_handle": "sample-product",
"product_url": "/products/sample-product",
"variant_title": "01",
"product_type": "default",
"price": "1.00",
"compare_at_price": "1.00",
"origin_price": "1.00",
"line_price": "2.00",
"original_line_price": 2,
"saved_price": 0,
"final_line_price": "2.00",
"final_price": "1.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 999999999,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
"width": 3000,
"height": 1500,
"alt": ""
},
"options": [
{
"name": "Size",
"value": "01"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "1.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-08-10T07:28:24Z",
"inventory_quantity": 0,
"inventory_policy": "",
"inventory_tracking": false,
"cost_price": "1.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
},
{
"id": "684698318307074183_d41d8cd98f00b204e9800998ecf8427e",
"item_id": "684698318307074183",
"product_id": "b3b656ae-504f-4f01-a054-879a610925e3",
"variant_id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"quantity": "2",
"note": "",
"properties": "",
"custom": false,
"product_title": "Sample product",
"product_handle": "Sample product",
"product_url": "/products/Sample product",
"variant_title": "Black-S",
"product_type": "default",
"price": "10.00",
"compare_at_price": "20.00",
"origin_price": "10.00",
"line_price": "20.00",
"original_line_price": 40,
"saved_price": 10,
"final_line_price": "20.00",
"final_price": "10.00",
"discount_applications": [],
"fixed_discount_total": "0.00",
"discount_total": "0.00",
"discount_id": "",
"available": true,
"available_quantity": 48,
"can_buy": true,
"weight": "0.00",
"weight_unit": "kg",
"sku": "1111-BLACK-S-A001001",
"spu": "1111",
"requires_shipping": true,
"taxable": false,
"image": {
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "10.00"
}
],
"parts_price": "0.00",
"product_tags": [],
"published": true,
"published_at": "2026-07-30T02:28:23Z",
"inventory_quantity": 48,
"inventory_policy": "deny",
"inventory_tracking": true,
"cost_price": "10.00",
"vendor": "",
"vendor_url": "",
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"item_text": "",
"disabled": false,
"is_free_gift": false,
"custom_discounts": []
}
],
"ineffectives": [],
"discount_applications": [],
"attributes": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"currency": "USD",
"original_line_price": "0.00",
"original_total_price": "0.00",
"line_price": "0.00",
"total_price": "0.00",
"note": "",
"created_at": "2026-06-23T19:57:16Z",
"updated_at": "2026-09-02T14:13:27Z",
"item_count": 0,
"total_weight": 0,
"invalid_msg": "",
"identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
"user_id": ""
}
}
Save a note on the cart
POST /{locale}/api/cart/note
Use the POST /{locale}/api/cart/note endpoint to save a note on the cart. The body is application/x-www-form-urlencoded, not JSON.
Example request
const body = new URLSearchParams({ note: 'Leave the parcel at the door' });
fetch(window.SHOPLAZZA.routes.root + '/api/cart/note', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: body
})
.then((response) => response.json())
.then((data) => {
// do something...
});
Request parameters
The note to save on the cart.
Response
- Schema
- Example
Request result flag; success or 0 means the request succeeded.
Result message returned with the response.
List of errors returned when the request fails.
The response payload.
{
"state": "success",
"message": "success",
"errors": [],
"data": null
}
Get the number of items in the cart
GET /{locale}/api/cart/count
Use the GET /{locale}/api/cart/count endpoint to get cart count.
Example request
fetch(window.SHOPLAZZA.routes.root + '/api/cart/count')
.then((response) => response.json())
.then((data) => {
// do something...
})
.catch((error) => {
console.error('Error: ', error);
});
Response
- Schema
- Example
Request result flag; success or 0 means the request succeeded.
Result message returned with the response.
List of errors returned when the request fails.
data object
The response payload.
Number of items in the cart.
{
"state": "success",
"message": "success",
"errors": [],
"data": {
"count": 2
}
}