Skip to main content

Retrieve Cart Items

Adds a new product to the cart or increases quantity if the product already exists.

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

Request Body

FieldTypeRequiredDescription
productIntegerYesProduct ID to add to cart
quantityIntegerNoQuantity to add (default: 1, minimum: 1)
notesStringNoCustomer notes for this item (max 500 chars)

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())

Status Codes

CodeDescription
200Items retrieved successfully
401Unauthorized — authentication required
404Item not found
500Internal server error

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)