Baskets
Basket management operations
This method retrieves a list of all active baskets for the current session.
Returns basic information about each basket including the primary key and namespace. This is useful for displaying available baskets to users or for basket management interfaces.
Use Cases:
Display user's available baskets
Basket switching interfaces
Administrative basket overview
Successfully retrieved basket list
GET /baskets/basket-list/ HTTP/1.1
Host: {commerce_url}
Accept: */*
Successfully retrieved basket list
{
"baskets": [
{
"pk": 123,
"namespace": "main"
},
{
"pk": 124,
"namespace": "wishlist"
},
{
"pk": 125,
"namespace": null
}
]
}
This method sets a specific basket as the main/active basket using its primary key (ID).
When a basket is set as main, it becomes the default basket for the current session. The basket's namespace is stored in the user's session for subsequent operations.
Use Cases:
Switch between different user baskets
Set a saved basket as the current active basket
Restore a previous shopping session
Primary key (ID) of the basket to set as main
Successfully set basket as main
Basket not found
POST /baskets/basket-list/id/{pk}/main/ HTTP/1.1
Host: {commerce_url}
Accept: */*
{
"basket": {
"pk": 123,
"namespace": "main",
"total_quantity": 3,
"total_amount": "89.97",
"basketitem_set": []
}
}
This method retrieves detailed information about discounts applied to a specific basket.
Returns comprehensive discount information including sample products, allowed quantities, and detailed breakdown of promotional benefits. This is particularly useful for understanding complex promotional structures and sample product offerings.
Use Cases:
Display detailed discount information to users
Promotional analysis and reporting
Sample product management
Marketing campaign effectiveness tracking
Primary key (ID) of the basket
Successfully retrieved detailed discounts
Basket not found
GET /baskets/basket-list/id/{pk}/detailed_discounts/ HTTP/1.1
Host: {commerce_url}
Accept: */*
[
{
"description": "10% off electronics",
"discount": "15.00",
"affects": "basket",
"sample_products": [],
"allowed_quantity": 5
},
{
"description": "Free sample with purchase",
"discount": "0.00",
"affects": "item",
"sample_products": [
{
"name": "Sample Product",
"sku": "SAMPLE001"
}
],
"allowed_quantity": 1
}
]
This method sets a specific basket as the main/active basket using its namespace identifier.
Namespaces allow for logical separation of baskets (e.g., "main", "wishlist", "saved"). When a basket is set as main by namespace, it becomes the default basket for the current session.
Special handling:
Use "null" as namespace parameter to select baskets with null namespace
The namespace is stored in the user's session for subsequent operations
Use Cases:
Switch between thematic baskets (main cart vs wishlist)
Restore namespace-specific shopping sessions
Multi-store or multi-context basket management
Namespace identifier for the basket. Use "null" for baskets with null namespace.
Successfully set basket as main
Basket not found for the specified namespace
POST /baskets/basket-list/ns/{namespace}/main/ HTTP/1.1
Host: {commerce_url}
Accept: */*
{
"basket": {
"pk": 124,
"namespace": "main",
"total_quantity": 2,
"total_amount": "59.98",
"basketitem_set": []
}
}
This method permanently deletes a specific basket identified by its ID.
Once deleted, the basket and all its items are removed from the system. This operation cannot be undone, so use with caution.
Use Cases:
Clean up abandoned or unwanted baskets
User-initiated basket deletion
Administrative basket management
Session cleanup operations
Unique identifier of the basket to delete
Basket successfully deleted (no content returned)
No content
Basket not found
DELETE /baskets/basket-list/{basket_id}/ HTTP/1.1
Host: {commerce_url}
Accept: */*
No content
This method retrieves comprehensive details about a specific basket using its namespace identifier.
Returns complete basket information including all items, pricing, discounts, and metadata. The endpoint also handles unavailable products by removing them from the basket automatically and applies current promotional offers.
Special handling:
Use "null" as namespace parameter to access baskets with null namespace
Unavailable products are automatically removed from the basket
Promotional offers are automatically applied before returning data
Use Cases:
Display full basket details to users
Checkout page data loading
Basket review and modification interfaces
Order preparation workflows
Namespace identifier for the basket. Use "null" for baskets with null namespace.
Successfully retrieved basket details
Basket not found for the specified namespace
GET /baskets/basket/{namespace}/ HTTP/1.1
Host: {commerce_url}
Accept: */*
{
"basket": {
"pk": 124,
"namespace": "main",
"total_quantity": 3,
"total_amount": "149.95",
"total_discount_amount": "15.00",
"total_product_amount": "164.95",
"basketitem_set": [
{
"id": 456,
"quantity": 2,
"unit_price": "29.99",
"product": {
"name": "Sample Product",
"sku": "SKU001"
}
}
],
"discounts": [],
"voucher_code": null,
"unavailable_basket_products": []
}
}
This method retrieves minimal basket information using its namespace identifier.
Returns only essential basket information like primary key and total quantity, optimized for quick loading scenarios such as header cart indicators or navigation elements where full basket details are not needed.
Special handling:
Use "null" as namespace parameter to access baskets with null namespace
Lightweight response for performance-critical scenarios
Use Cases:
Shopping cart icon with item count
Quick basket status checks
Mobile app header indicators
Performance-sensitive basket summaries
Namespace identifier for the basket. Use "null" for baskets with null namespace.
Successfully retrieved mini basket information
Basket not found for the specified namespace
GET /baskets/basket/{namespace}/mini/ HTTP/1.1
Host: {commerce_url}
Accept: */*
{
"pk": 124,
"total_quantity": 3
}
Was this helpful?