Baskets

Basket management operations

List Active Baskets

get

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

Authorizations
Responses
200

Successfully retrieved basket list

application/json
get
GET /baskets/basket-list/ HTTP/1.1
Host: {commerce_url}
Accept: */*
200

Successfully retrieved basket list

{
  "baskets": [
    {
      "pk": 123,
      "namespace": "main"
    },
    {
      "pk": 124,
      "namespace": "wishlist"
    },
    {
      "pk": 125,
      "namespace": null
    }
  ]
}

Set Main Basket by ID

post

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

Authorizations
Path parameters
pkintegerRequired

Primary key (ID) of the basket to set as main

Responses
200

Successfully set basket as main

application/json
post
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": []
  }
}

Get Detailed Basket Discounts

get

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

Authorizations
Path parameters
pkintegerRequired

Primary key (ID) of the basket

Responses
200

Successfully retrieved detailed discounts

application/json
get
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
  }
]

Set Main Basket by Namespace

post

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

Authorizations
Path parameters
namespacestringRequired

Namespace identifier for the basket. Use "null" for baskets with null namespace.

Responses
200

Successfully set basket as main

application/json
post
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": []
  }
}

Delete Basket

delete

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

Authorizations
Path parameters
basket_idintegerRequired

Unique identifier of the basket to delete

Responses
204

Basket successfully deleted (no content returned)

No content

delete
DELETE /baskets/basket-list/{basket_id}/ HTTP/1.1
Host: {commerce_url}
Accept: */*

No content

Get Basket Detail by Namespace

get

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

Authorizations
Path parameters
namespacestringRequired

Namespace identifier for the basket. Use "null" for baskets with null namespace.

Responses
200

Successfully retrieved basket details

application/json
get
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": []
  }
}

Get Mini Basket by Namespace

get

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

Authorizations
Path parameters
namespacestringRequired

Namespace identifier for the basket. Use "null" for baskets with null namespace.

Responses
200

Successfully retrieved mini basket information

application/json
get
GET /baskets/basket/{namespace}/mini/ HTTP/1.1
Host: {commerce_url}
Accept: */*
{
  "pk": 124,
  "total_quantity": 3
}

Was this helpful?