Cart Operations
Get cart, add/update/remove items, clear cart, apply/remove coupons, and cart count
Last updated: Feb 09, 2026
Cart Operations
Note: All cart endpoints require authentication.
Get Cart
Get current cart contents.
GET /api/v1/cart
Response: 200 OK
{
"success": true,
"data": {
"id": 1,
"items": [
{
"id": 1,
"product_id": 5,
"product_name": "Premium Yoga Mat",
"product_image": "https://domain.com/storage/products/yoga-mat.jpg",
"price": 24.99,
"quantity": 2,
"total": 49.98
}
],
"subtotal": 49.98,
"discount": 0,
"shipping": 0,
"tax": 9.00,
"total": 58.98,
"coupon_code": null,
"item_count": 2
}
}
Add to Cart
Add a product to cart.
POST /api/v1/cart/add
Request Body:
{
"product_id": 5,
"quantity": 2,
"variant_id": null
}
Update Cart Item
Update quantity of a cart item.
PUT /api/v1/cart/items/{id}
Request Body:
{
"quantity": 3
}
Remove Cart Item
Remove an item from cart.
DELETE /api/v1/cart/items/{id}
Clear Cart
Remove all items from cart.
DELETE /api/v1/cart/clear
Apply Coupon
Apply a discount coupon.
POST /api/v1/cart/apply-coupon
Request Body:
{
"coupon_code": "SAVE20"
}
Remove Coupon
Remove applied coupon.
DELETE /api/v1/cart/remove-coupon
Get Cart Count
Get number of items in cart.
GET /api/v1/cart/count
Response: 200 OK
{
"success": true,
"data": {
"count": 3
}
}