Skip to main content

Retrieve A Cart Item

Retrieve cart item details by id

HTTP Request

GET/api/shop/cart/items/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Authenticated User
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesID of the cart item to retrieve

Example Requests

1import requests
2
3response = requests.get('http://www.example.com/api/shop/cart/items/789', 
4  headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())

Response Fields

FieldTypeDescription
idIntegerUnique ID of the cart item
refStringItem reference (read-only)
productObjectProduct information with `id`, `name`, `image`
quantityIntegerItem quantity
notesStringCustomer notes for this item
created_atString (ISO 8601)Timestamp when item was added
updated_atString (ISO 8601)Timestamp when item was last updated
unit_priceIntegerPrice per unit (read-only)
unit_discountIntegerDiscount per unit (read-only)
subtotalIntegerItem subtotal before discount (read-only)
discountIntegerTotal item discount (read-only)
totalIntegerFinal item total (read-only)

Product Object Data Structure

FieldTypeDescription
idIntegerUnique id of the product
titleStringProduct title
imageObjectProduct image details

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image/jpeg)
nameStringOriginal file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB)
fStringURL to access the image file
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringColor mode (e.g., RGB, CMYK)

Example Response

{
"id": 4,
"ref": "54",
"product": {
"id": 54,
"title": "درب سمت راست پراید",
"image": null
},
"quantity": 2,
"notes": "Ut facilis aspernatur odit molestiae. Voluptates eveniet nihil sed qui. Soluta ex quo eum. Magni asperiores aliquam et. Vel qui molestiae culpa autem.",
"created_at": "2025-12-30T13:17:46.941326Z",
"updated_at": "2025-12-30T13:17:46.941335Z",
"unit_price": 1000,
"unit_discount": 100,
"subtotal": 2000,
"discount": 200,
"total": 1800
}