Cart
Overview
The cart can be used by both anonymous and registered users. A registered user needs a Bearer token, while an anonymous user can use a special basket token, which can be obtained, for example, when receiving the contents of the basket, and then transmitted in the headers.
1. Cart content
Endpoint
GET /api/v1/shop/cart
Request Headers
{
"Authorization": "Bearer token here (OPTIONAL)",
"X-API-Key": "123456789",
"Content-Type": "application/json",
"X-Cart-ID": "guest_763d1369-5bb8-4745-9e4d-4612126bcdb8 (OPTIONAL)"
}
Request Body
{}
Expected Response for unregistered user
{
"success": true,
"message": "Cart retrieved successfully",
"data": {
"cart_id": "guest_5fd5a551-02e3-4bcb-b778-1344edd6bd49",
"cart_data": {
"id": "guest_5fd5a551-02e3-4bcb-b778-1344edd6bd49",
"total": 0,
"formatted_total": "0.00",
"items_count": 0,
"items_quantity": 0,
"is_empty": true,
"items": []
},
"is_new_cart": false
}
}
Expected Response for registered user
{
"success": true,
"message": "Cart retrieved successfully",
"data": {
"cart_id": "user_182",
"cart_data": {
"id": "user_182",
"total": 0,
"formatted_total": "0.00",
"items_count": 0,
"items_quantity": 0,
"is_empty": true,
"items": []
},
"is_new_cart": false
}
}
2. Add item (product) to cart
Endpoint
POST /api/v1/shop/cart/{productSku}
Request Headers
{
"Authorization": "Bearer token here (OPTIONAL)",
"X-API-Key": "123456789",
"Content-Type": "application/json",
"X-Cart-ID": "guest_763d1369-5bb8-4745-9e4d-4612126bcdb8 (OPTIONAL)"
}
Request Body
{
"quantity": 1,
"options": {
"team_id": "20"
}
}
Expected Response
{
"success": true,
"message": "Product added to cart successfully",
"data": {
"cart_id": "user_182",
"cart_data": {
"id": "user_182",
"total": 110,
"formatted_total": "110.00",
"items_count": 1,
"items_quantity": 1,
"is_empty": false,
"items": [
{
"id": "CK-SDS001",
"sku": "CK-SDS001",
"name": "Complete Kit",
"price": 110,
"quantity": 1,
"subtotal": 110,
"options": {
"product_id": 1,
"sku": "CK-SDS001",
"type": "physical",
"code": "complete_kit",
"requires_team": true,
"team_id": "20"
},
"stock": 1000,
"meta": [
{
"meta_key": "cover",
"meta_value": "images/shop/complete_kit/cover_img.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_1.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_2.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_3.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_4.png"
}
]
}
]
},
"added_item": {
"id": "CK-SDS001",
"sku": "CK-SDS001",
"name": "Complete Kit",
"price": 110,
"quantity": 1,
"subtotal": 110,
"options": {
"product_id": 1,
"sku": "CK-SDS001",
"type": "physical",
"code": "complete_kit",
"requires_team": true,
"team_id": "20"
},
"stock": 1000,
"meta": [
{
"meta_key": "cover",
"meta_value": "images/shop/complete_kit/cover_img.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_1.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_2.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_3.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_4.png"
}
]
}
}
}
3. Update item (product) to cart
Endpoint
PUT /api/v1/shop/cart/{productSku}
Request Headers
{
"Authorization": "Bearer token here (OPTIONAL)",
"X-API-Key": "123456789",
"Content-Type": "application/json",
"X-Cart-ID": "guest_763d1369-5bb8-4745-9e4d-4612126bcdb8 (OPTIONAL)"
}
Request Body
{
"quantity": 1,
"options": {
"team_id": "80"
}
}
Expected Response
{
"success": true,
"message": "Cart item updated successfully",
"data": {
"cart_id": "user_182",
"cart_data": {
"id": "user_182",
"total": 110,
"formatted_total": "110.00",
"items_count": 1,
"items_quantity": 1,
"is_empty": false,
"items": [
{
"id": "CK-SDS001",
"sku": "CK-SDS001",
"name": "Complete Kit",
"price": 110,
"quantity": 1,
"subtotal": 110,
"options": {
"team_id": "80"
},
"stock": 1000,
"meta": [
{
"meta_key": "cover",
"meta_value": "images/shop/complete_kit/cover_img.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_1.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_2.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_3.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_4.png"
}
]
}
]
},
"updated_item": {
"id": "CK-SDS001",
"sku": "CK-SDS001",
"name": "Complete Kit",
"price": 110,
"quantity": 1,
"subtotal": 110,
"options": {
"team_id": "80"
},
"stock": 1000,
"meta": [
{
"meta_key": "cover",
"meta_value": "images/shop/complete_kit/cover_img.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_1.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_2.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_3.png"
},
{
"meta_key": "gallery",
"meta_value": "images/shop/complete_kit/gallery_4.png"
}
]
}
}
}
4. Delete item (product) in cart
Endpoint
DELETE /api/v1/shop/cart/{productSku}
Request Headers
{
"Authorization": "Bearer token here (OPTIONAL)",
"X-API-Key": "123456789",
"Content-Type": "application/json",
"X-Cart-ID": "guest_763d1369-5bb8-4745-9e4d-4612126bcdb8 (OPTIONAL)"
}
Request Body
{}
Expected Response
{
"success": true,
"message": "Cart item removed successfully",
"data": {
"cart_id": "user_182",
"cart_data": {
"id": "user_182",
"total": 0,
"formatted_total": "0.00",
"items_count": 0,
"items_quantity": 0,
"is_empty": true,
"items": []
}
}
}
5. Delete all items in cart (Clear cart)
Endpoint
DELETE /api/v1/shop/cart
Request Headers
{
"Authorization": "Bearer token here (OPTIONAL)",
"X-API-Key": "123456789",
"Content-Type": "application/json",
"X-Cart-ID": "guest_763d1369-5bb8-4745-9e4d-4612126bcdb8 (OPTIONAL)"
}
Request Body
{}
Expected Response
{
"success": true,
"message": "Cart cleared successfully",
"data": {
"cart_id": "user_182",
"cart_data": {
"id": "user_182",
"total": 0,
"formatted_total": "0.00",
"items_count": 0,
"items_quantity": 0,
"is_empty": true,
"items": []
}
}
}
25 February 2026