Remove Item from Cart
Removes an item from the cart completely.
HTTP Request
DELETE/api/shop/cart/items/:id
Authorization
Authorization
- Required: Yes
- Permission: Authenticated User
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | ID of the cart item to remove |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3response = requests.delete('http://www.example.com/api/shop/cart/items/789',
4 headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())1curl -X DELETE "http://www.example.com/api/shop/cart/items/789" -H "Authorization: Token <your_api_key>"Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the product |
| address | Integer | Selected delivery address ID |
| shipping_method | Integer | Selected shipping method ID |
| payment_method | Integer | Selected payment method ID |
| created_at | String (ISO 8601) | Timestamp when cart was created |
| updated_at | String (ISO 8601) | Timestamp when cart was last updated |
| count | Integer | Number of unique items in cart |
| quantity | Integer | Total quantity of all items |
| is_empty | Boolean | Whether the cart is empty |
| items_subtotal | Integer | Subtotal of all items before discounts |
| items_discount | Integer | Total discount amount on items |
| subtotal | Integer | Cart subtotal after item discounts |
| discount | Integer | Additional cart-level discount |
| total | Integer | Final cart total |
| items | Array | Array of cart items (see Cart Item fields) |
Cart Item Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the cart item |
| ref | String | Item reference (read-only) |
| product | Object | Product information with `id`, `name`, `image` |
| quantity | Integer | Item quantity |
| notes | String | Customer notes for this item |
| created_at | String (ISO 8601) | Timestamp when item was added |
| updated_at | String (ISO 8601) | Timestamp when item was last updated |
| unit_price | Integer | Price per unit (read-only) |
| unit_discount | Integer | Discount per unit (read-only) |
| subtotal | Integer | Item subtotal before discount (read-only) |
| discount | Integer | Total item discount (read-only) |
| total | Integer | Final item total (read-only) |
Product Object Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique id of the product |
| title | String | Product title |
| image | Object | Product image details |
Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| type | String | File type (e.g., image/jpeg) |
| name | String | Original file name |
| size | Integer | File size in bytes |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels |
| height | Integer | Image height in pixels |
| mode | String | Color mode (e.g., RGB, CMYK) |
Example Respones
{
"id": 1,
"address": 1,
"shipping_method": 1,
"payment_method": 1,
"created_at": "2025-11-22T15:26:59.108182Z",
"updated_at": "2025-12-30T12:53:24.505447Z",
"count": 1,
"quantity": 2,
"is_empty": false,
"items_subtotal": 24000000,
"items_discount": 2480000,
"subtotal": 24000000,
"discount": 2480000,
"shipping_cost": 0,
"total": 21520000,
"items": [
{
"id": 5,
"ref": "36",
"product": {
"id": 36,
"title": "ماوس لاجیتک MX Vertical",
"image": {
"id": 2,
"type": "image",
"name": "logitech-mx-1",
"size": 4766,
"human_readable_size": "4.65 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech-mx-1.jpg",
"width": 225,
"height": 225,
"mode": "RGB"
}
},
"quantity": 2,
"notes": "Voluptatem sint sunt corrupti vitae recusandae. Tenetur ratione ipsum quaerat. Architecto rerum voluptatem quod.",
"created_at": "2025-12-30T13:38:25.196625Z",
"updated_at": "2025-12-30T13:38:25.196632Z",
"unit_price": 12000000,
"unit_discount": 1240000,
"subtotal": 24000000,
"discount": 2480000,
"total": 21520000
}
]
}