Cart API reference
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 /{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.
fetch(window.SHOPLAZZA.routes.root + '/api/cart', {
headers: {
'Content-Type': 'application/json'
}
})
.then((response) => response.json())
.then((data) => {
// do something...
});
Responses
JSON of a cart
{
"cart": {
"line_items": [
{
"id": "297857_1825cbb82902c53fdc4e12283829e832",
"properties": "",
"note": "",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"quantity": "1",
"discount_id": "65c00d9b-060c-4206-a2d8-f2971cacee43",
"limit_time": -1,
"limit_buy": 0,
"user_limit_buy": -1,
"discount_sales": 1,
"discount_sales_rate": "1",
"discount_stock": 87,
"ends_at": -1,
"starts_at": 1682405275,
"allow_oversold": "uncheck",
"allocation_method": "none",
"price": "205.2",
"compare_at_price": "228",
"discount_price": "205.2",
"customary_saved_price": "22.8",
"customary_off_ratio": 10,
"discount_saved_price": "22.8",
"discount_off_ratio": "10",
"use_before_price": false,
"before_price": "188",
"title": "促销",
"trunk_price": "0",
"total_price": "0",
"inventory_tracking": true,
"inventory_policy": "deny",
"inventory_quantity": 87,
"cart_id": "297857",
"store_id": "7126",
"user_id": "0181ba0b-1ca4-44b9-be0d-f6052e9f0fc8",
"user_sign": "",
"created_at": "2023-07-06 09:09:05",
"updated_at": "2023-07-07 02:13:42",
"custom": false,
"parts_price": null,
"variant_title": "pink",
"product_title": "Sale Squared Sunglasses ",
"product_handle": "sale-squared-sunglasses",
"product_tags": [
"Color_Lightcoral",
"Location_Alabama",
"Price_$200-$300"
],
"published": true,
"published_at": "2022-08-11T08:15:07Z",
"product_url": "/products/sale-squared-sunglasses",
"available": true,
"available_quantity": 87,
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"vendor": "Nero Theme Fashion",
"vendor_url": "",
"taxable": false,
"requires_shipping": true,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/d8217e1e2e216cd8b71b1035bde035ec.jpeg",
"path": "d8217e1e2e216cd8b71b1035bde035ec.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "pink"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "205.20"
}
],
"discount_applications": [
{
"type": "discount_flashsale",
"subtype": "discount_flashsale",
"discount_id": "65c00d9b-060c-4206-a2d8-f2971cacee43",
"title": "促销",
"value": "",
"discount_type": "",
"value_type": "",
"allocation_method": "",
"target_selection": "",
"target_type": "",
"total_discount_amount": "0",
"discount_amount": "0",
"is_free_gift": false,
"icon": "//cdn.shoplazza.com/oss/operation/372e6ab307143855fbd0ad3d28568d1e.svg"
}
],
"saved_price": 22.8,
"line_price": "205.20",
"original_line_price": 228,
"flashsale_tip": false,
"discount_info": {
"id": "297857",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"quantity": 1,
"discount_id": "65c00d9b-060c-4206-a2d8-f2971cacee43",
"limit_time": -1,
"limit_buy": 0,
"user_limit_buy": -1,
"discount_sales": 1,
"discount_sales_rate": "1",
"discount_stock": 87,
"ends_at": -1,
"starts_at": 1682405275,
"allow_oversold": "uncheck",
"allocation_method": "none",
"price": "205.2",
"compare_at_price": "228",
"discount_price": "205.2",
"customary_saved_price": "22.8",
"customary_off_ratio": "10",
"discount_saved_price": "22.8",
"discount_off_ratio": "10",
"use_before_price": false,
"before_price": "188",
"title": "促销",
"trunk_price": "0",
"total_price": "0",
"inventory_tracking": true,
"inventory_policy": "deny",
"inventory_quantity": 87
},
"item_id": "297857",
"can_buy": true,
"discount_total": "0.00",
"final_line_price": "205.20",
"final_price": "205.20"
}
],
"ineffectives": [],
"invalid_msg": "",
"currency": "USD",
"note": "",
"created_at": "2023-06-27T08:56:37Z",
"updated_at": "2023-07-07T02:13:42Z",
"item_count": 1,
"original_line_price": "228.00",
"original_total_price": "228.00",
"line_price": "205.20",
"total_price": "185.20",
"total_discount": "20.00",
"total_weight": 0,
"discount_line_item_price": "20.00",
"discount_applications": [
{
"type": "discount_rebate",
"subtype": "discount_rebate",
"title": "满减",
"discount_amount": 20,
"message": "",
"discount_message": "",
"discount_id": "53b13206-6de7-48dd-baa5-a542f5be26f5",
"value_type": "fixed_amount",
"target_type": "line_item",
"apply_method": "",
"target_selection": "entitled",
"discount_type": "discount_rebate",
"entitled_product_list": [
{
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"price": "205.2",
"quantity": 1
}
],
"icon": "//cdn.shoplazza.com/oss/operation/52a3d7f0a272be85092170dc93eefe81.svg"
}
]
}
}
JSON of an empty cart
{
"cart": {
"line_items": [],
"ineffectives": [],
"invalid_msg": "",
"currency": "USD",
"note": "",
"created_at": "2023-06-27T08:56:37Z",
"updated_at": "2023-07-07T02:14:39Z",
"item_count": 0,
"original_line_price": 0,
"original_total_price": 0,
"line_price": 0,
"total_price": 0,
"total_discount": "0.00",
"total_weight": 0,
"discount_line_item_price": "0.00",
"discount_applications": []
}
}
POST /{locale}/api/cart
Use the POST /{locale}/api/cart
endpoint to add a single variant to the cart.
Request parameter
For example:
{
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"quantity": 1,
"refer_info": {
"source": "add_to_cart"
}
}
Example API calls
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"
}
};
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);
});
{
"data": {
"items": [
{
"item_id": "298397",
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"quantity": 2,
"properties": null,
"custom": false,
"price": "205.20",
"trunk_price": null,
"parts_price": null,
"refer_info": {
"source": "add_to_cart"
},
"note": null,
"add_quantity": 1,
"variant_title": "pink",
"product_title": "Sale Squared Sunglasses ",
"product_handle": "sale-squared-sunglasses",
"product_tags": [
"Color_Lightcoral",
"Location_Alabama",
"Price_$200-$300"
],
"published": true,
"published_at": "2022-08-11T08:15:07Z",
"product_url": "/products/sale-squared-sunglasses",
"inventory_quantity": 87,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 87,
"compare_at_price": "228.00",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"vendor": "Nero Theme Fashion",
"vendor_url": "",
"taxable": false,
"requires_shipping": true,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/d8217e1e2e216cd8b71b1035bde035ec.jpeg",
"path": "d8217e1e2e216cd8b71b1035bde035ec.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "pink"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "205.20"
}
]
}
]
},
"state": "success",
"message": "",
"errors": []
}
POST /{locale}/api/cart/batch
Use the POST /{locale}/api/cart/batch
endpoint to add one or multiple variants to the cart. Request parameter refer to Request parameter
Example for calls
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
},
{
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);
});
{
"items": [
{
"product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
"variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
"quantity": 1,
"properties": null,
"custom": false,
"note": null,
"price": "205.20",
"trunk_price": null,
"parts_price": null,
"add_quantity": 1,
"variant_title": "pink",
"product_title": "Sale Squared Sunglasses ",
"product_handle": "sale-squared-sunglasses",
"product_tags": [
"Color_Lightcoral",
"Location_Alabama",
"Price_$200-$300"
],
"published": true,
"published_at": "2022-08-11T08:15:07Z",
"product_url": "/products/sale-squared-sunglasses",
"inventory_quantity": 87,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 87,
"compare_at_price": "228.00",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "",
"spu": "",
"vendor": "Nero Theme Fashion",
"vendor_url": "",
"taxable": false,
"requires_shipping": true,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/d8217e1e2e216cd8b71b1035bde035ec.jpeg",
"path": "d8217e1e2e216cd8b71b1035bde035ec.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "pink"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "205.20"
}
],
"item_id": "298421"
},
{
"quantity": 2,
"product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
"variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
"properties": null,
"custom": false,
"note": null,
"price": "255.00",
"trunk_price": null,
"parts_price": null,
"add_quantity": 2,
"variant_title": "DarkOliveGreen-S",
"product_title": "Zoe Fedora",
"product_handle": "zoe-fedora",
"product_tags": [
"Color_DarkGray",
"Color_Lightcoral",
"Location_Colorado",
"Price_$200-$300"
],
"published": true,
"published_at": "2022-02-10T02:30:49Z",
"product_url": "/products/zoe-fedora",
"inventory_quantity": 74,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 74,
"compare_at_price": "0.00",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "WJW19F1014LA14-1",
"spu": "",
"vendor": "Nero",
"vendor_url": "",
"taxable": false,
"requires_shipping": true,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/9974fe2bd69a80624c2c47976568b252.jpeg",
"path": "9974fe2bd69a80624c2c47976568b252.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "DarkOliveGreen"
},
{
"name": "Size",
"value": "S"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "255.00"
}
],
"item_id": "298422"
}
]
}
PATCH /{locale}/api/cart/{variant_id}
Use the PATCH /{locale}/api/cart/{variant_id}
endpoint to update the cart's line item quantities.
Example API calls
To update line item quantities, you can make a PATCH
request with an updates
object. The updates
object must contain parameters in the following:
- The line item's id
- The line item's product_id
- The line item's variant_id
- The new
quantity
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,
};
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);
});
{
"cart": {
"line_items": [
{
"id": "298447_d41d8cd98f00b204e9800998ecf8427e",
"properties": "",
"note": null,
"cart_id": "298447",
"store_id": "7126",
"user_id": "0181ba0b-1ca4-44b9-be0d-f6052e9f0fc8",
"user_sign": "",
"product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
"variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
"quantity": "3",
"created_at": "2023-07-07 03:15:07",
"updated_at": "2023-07-07 03:16:25",
"custom": false,
"price": "255",
"trunk_price": "0",
"parts_price": null,
"variant_title": "DarkOliveGreen-S",
"product_title": "Zoe Fedora",
"product_handle": "zoe-fedora",
"product_tags": [
"Color_DarkGray",
"Color_Lightcoral",
"Location_Colorado",
"Price_$200-$300"
],
"published": true,
"published_at": "2022-02-10T02:30:49Z",
"product_url": "/products/zoe-fedora",
"inventory_quantity": 74,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 74,
"compare_at_price": "0",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "WJW19F1014LA14-1",
"spu": "",
"vendor": "Nero",
"vendor_url": "",
"taxable": false,
"requires_shipping": true,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/9974fe2bd69a80624c2c47976568b252.jpeg",
"path": "9974fe2bd69a80624c2c47976568b252.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "DarkOliveGreen"
},
{
"name": "Size",
"value": "S"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "255.00"
}
],
"total_price": "0",
"discount_applications": [],
"saved_price": -255,
"line_price": "765.00",
"original_line_price": 0,
"customary_off_ratio": 0,
"flashsale_tip": false,
"item_id": "298447",
"can_buy": true,
"discount_total": "0.00",
"final_line_price": "765.00",
"final_price": "255.00"
},
{
"id": "298446_d41d8cd98f00b204e9800998ecf8427e",
"properties": "",
"note": "",
"cart_id": "298446",
"store_id": "7126",
"user_id": "0181ba0b-1ca4-44b9-be0d-f6052e9f0fc8",
"user_sign": "",
"product_id": "ddd0cadc-9ef2-4854-a0c5-67d62652cc61",
"variant_id": "f4325691-9686-4e9f-baa3-17991a840467",
"quantity": "2",
"created_at": "2023-07-07 03:15:00",
"updated_at": "2023-07-07 03:15:18",
"custom": false,
"price": "289",
"trunk_price": "0",
"parts_price": null,
"variant_title": "Slategray",
"product_title": "All Glass Sunglasses",
"product_handle": "all-glass-sunglasses",
"product_tags": [
"new"
],
"published": true,
"published_at": "2022-02-10T02:30:50Z",
"product_url": "/products/all-glass-sunglasses",
"inventory_quantity": 649,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 649,
"compare_at_price": "0",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "RNB5019S",
"spu": "SPU",
"vendor": "Nero Theme Fashion",
"vendor_url": "",
"taxable": false,
"requires_shipping": false,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/f4621061e95abd9455031ad7162bac15.jpeg",
"path": "f4621061e95abd9455031ad7162bac15.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "Slategray"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "289.00"
}
],
"total_price": "0",
"discount_applications": [],
"saved_price": -289,
"line_price": "578.00",
"original_line_price": 0,
"customary_off_ratio": 0,
"flashsale_tip": false,
"item_id": "298446",
"can_buy": true,
"discount_total": "0.00",
"final_line_price": "578.00",
"final_price": "289.00"
}
],
"ineffectives": [],
"discount_applications": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"invalid_msg": "",
"currency": "USD",
"note": "",
"created_at": "2023-06-27T08:56:37Z",
"updated_at": "2023-07-07T03:16:26Z",
"item_count": 5,
"original_line_price": "0.00",
"original_total_price": "0.00",
"line_price": "1343.00",
"total_price": "1343.00",
"total_weight": 0
}
}
DELETE /{locale}/api/cart/{variant_id}
Use the DELETE /{locale}/api/cart/{variant_id}
endpoint to remove a line item.
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);
});
{
"cart": {
"line_items": [
{
"id": "298447_d41d8cd98f00b204e9800998ecf8427e",
"properties": "",
"note": null,
"cart_id": "298447",
"store_id": "7126",
"user_id": "0181ba0b-1ca4-44b9-be0d-f6052e9f0fc8",
"user_sign": "",
"product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
"variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
"quantity": "3",
"created_at": "2023-07-07 03:15:07",
"updated_at": "2023-07-07 03:16:25",
"custom": false,
"price": "255",
"trunk_price": "0",
"parts_price": null,
"variant_title": "DarkOliveGreen-S",
"product_title": "Zoe Fedora",
"product_handle": "zoe-fedora",
"product_tags": [
"Color_DarkGray",
"Color_Lightcoral",
"Location_Colorado",
"Price_$200-$300"
],
"published": true,
"published_at": "2022-02-10T02:30:49Z",
"product_url": "/products/zoe-fedora",
"inventory_quantity": 74,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 74,
"compare_at_price": "0",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "WJW19F1014LA14-1",
"spu": "",
"vendor": "Nero",
"vendor_url": "",
"taxable": false,
"requires_shipping": true,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/9974fe2bd69a80624c2c47976568b252.jpeg",
"path": "9974fe2bd69a80624c2c47976568b252.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "DarkOliveGreen"
},
{
"name": "Size",
"value": "S"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "255.00"
}
],
"total_price": "0",
"discount_applications": [],
"saved_price": -255,
"line_price": "765.00",
"original_line_price": 0,
"customary_off_ratio": 0,
"flashsale_tip": false,
"item_id": "298447",
"can_buy": true,
"discount_total": "0.00",
"final_line_price": "765.00",
"final_price": "255.00"
},
{
"id": "298446_d41d8cd98f00b204e9800998ecf8427e",
"properties": "",
"note": "",
"cart_id": "298446",
"store_id": "7126",
"user_id": "0181ba0b-1ca4-44b9-be0d-f6052e9f0fc8",
"user_sign": "",
"product_id": "ddd0cadc-9ef2-4854-a0c5-67d62652cc61",
"variant_id": "f4325691-9686-4e9f-baa3-17991a840467",
"quantity": "2",
"created_at": "2023-07-07 03:15:00",
"updated_at": "2023-07-07 03:15:18",
"custom": false,
"price": "289",
"trunk_price": "0",
"parts_price": null,
"variant_title": "Slategray",
"product_title": "All Glass Sunglasses",
"product_handle": "all-glass-sunglasses",
"product_tags": [
"new"
],
"published": true,
"published_at": "2022-02-10T02:30:50Z",
"product_url": "/products/all-glass-sunglasses",
"inventory_quantity": 649,
"inventory_policy": "deny",
"inventory_tracking": true,
"available": true,
"available_quantity": 649,
"compare_at_price": "0",
"cost_price": "0.00",
"weight": "0.00",
"weight_unit": "kg",
"sku": "RNB5019S",
"spu": "SPU",
"vendor": "Nero Theme Fashion",
"vendor_url": "",
"taxable": false,
"requires_shipping": false,
"barcode": "",
"mixed_wholesale": false,
"tax_code": "",
"retail_price": "0.00",
"product_type": "",
"image": {
"src": "//cdn.shoplazza.com/f4621061e95abd9455031ad7162bac15.jpeg",
"path": "f4621061e95abd9455031ad7162bac15.jpeg",
"width": 1280,
"height": 1710,
"alt": ""
},
"options": [
{
"name": "Color",
"value": "Slategray"
}
],
"wholesale_price": [
{
"min_quantity": 1,
"price": "289.00"
}
],
"total_price": "0",
"discount_applications": [],
"saved_price": -289,
"line_price": "578.00",
"original_line_price": 0,
"customary_off_ratio": 0,
"flashsale_tip": false,
"item_id": "298446",
"can_buy": true,
"discount_total": "0.00",
"final_line_price": "578.00",
"final_price": "289.00"
}
],
"ineffectives": [],
"discount_applications": [],
"total_discount": "0.00",
"discount_line_item_price": "0.00",
"invalid_msg": "",
"currency": "USD",
"note": "",
"created_at": "2023-06-27T08:56:37Z",
"updated_at": "2023-07-07T03:16:26Z",
"item_count": 5,
"original_line_price": "0.00",
"original_total_price": "0.00",
"line_price": "1343.00",
"total_price": "1343.00",
"total_weight": 0
}
}
GET /{locale}/api/cart/count
Use the GET /{locale}/api/cart/count
endpoint to get cart count.
fetch(window.SHOPLAZZA.routes.root + '/api/cart/count')
.then((response) => response.json())
.then((data) => {
// do something...
})
.catch((error) => {
console.error('Error: ', error);
});
{
"data": {
"count": 2
},
"state": "success",
"message": "",
"errors": []
}
Updated over 1 year ago