Basket
The basket module handles the management of products within the basket and other related transactions. Each user is allowed to have a single active Basket
, and a BasketItem
is created for every unique item that users add to their basket.
Basket Model
id
integer
Database ID.
created_date
datetime (string)
Basket created on.
modified_date
datetime (string)
Basket last modified on.
status
string
Basket status. Basket status is defined on the BasketStatus enum.
version
integer
Version info. Version information is used to control whether the cached version matches the Basket data in the database.
user
integer
User account linked to the basket.
voucher_code
string
Basket discount code.
BasketItem Model
id
integer
Database ID.
created_date
datetime (string)
Basket item created on.
modified_date
datetime (string)
Basket item last modified on.
status
string
Version info. Version information is used to control whether the cached version matches the BasketItem data in the database.
attributes
dict
Additional attributes, if any, of the basket item.
attributes_kwargs
dict
Additional keywords for additional attributes, if any, of the basket item.
localized_attributes
dict
Additional localized attributes, if any, of the basket item.
localized_attributes_kwargs
dict
Additional keywords, if any, for additional localized attributes of the basket item.
basket
integer
Basket linked to the basket item.
reference
string
Unique key created for related basket item.
product
integer
Item linked to the basket item
quantity
integer
Quantity of basket item.
tax_rate
float
Tax rate of the basket item.
currency_type
string
Price currency of the basket item.
unit_price
float
Unit price of the basket item.
image
string
Thumbnail image of the basket item.
extra_product_price
integer
Additional product price variations, if any, for the basket item.
extra_product_stock
integer
Additional stock information, if any, for the basket item.
parent
integer
Parent product, if the basket item is a child product.
Basket Endpoints
product
integer
body
ID of the item to be added to the basket.
quantity
integer
body
Quantity of the item to be added to the basket.
attributes
dict
body
Product properties.
inquiry
dict
body
Product details, if the item is exchangeable.
sub_items
dict
body
Sub items.
GET
Basket Items
GET
Basket Items​Returns the basket and product information.
Path: https://{commerce_url}/baskets/basket/
Response
POST
Add New Product to Basket
POST
Add New Product to Basket​This method is used to add a new product to the basket.
Path: https://{commerce_url}/baskets/basket/
Request Body
​Response
Returns the same response as the GET method. ​
PATCH
Update a Product Quantity
PATCH
Update a Product QuantityUsed to change the quantity of a product added to the basket.
Path: https://{commerce_url}/baskets/basket/
Request Body
​Response
Returns the same response as the GET method. ​
PUT
Update a Product Quantity
PUT
Update a Product QuantityPath: https://{commerce_url}/baskets/basket/
Request Body
Response
Returns the same response as the GET method. ​
DELETE
Remove All Products From Basket
DELETE
Remove All Products From Basket​ This method is used to delete all products added to the basket.
Path: https://{commerce_url}/baskets/basket/
Response
PATCH
Update Single Basket Item
PATCH
Update Single Basket ItemThis method is used for making individual modification in basket items. If the basket item modification is successful, a new basket item is produced as a response. If the BasketItem
to be modified cannot be found, it returns an error code of 400.
Path: basket_items/$
Request Body
The following request body parameters can be used to update single basket item.
ID
integer
Database ID of the BasketItem
to be modified.
is_all
boolean
If true is submitted, then the update applies to all quantities of the basket item. If false is submitted, then the update applies to one basket item.
attributes
boolean
Additional attributes of the basket item to modify.
Data Parameters for PUT Method
product
integer
body
ID of the item to be added to the basket.
quantity
integer
body
Quantity of the item to be added to the basket.
attributes
dict
body
Product properties.
inquiry
dict
body
Product details, if the item is exchangeable.
Payload Example
Data Parameters for PATCH Method
external_offer_code
string
body
When this field is submitted, the code is applied to the basket without instant verification, regardless of other fields.
remove_voucher_code
boolean
body
When True is submitted, the discount code is removed from the basket. When submitted simultaneously with external_offer_code
, then the code submitted with external_offer_code
is not removed.
voucher_code
string
body
Discount code to apply to the basket. Instant verification is also applied to the code submitted here.
Payload Examples
Data Parameters for DELETE Method
There are no data parameters for the DELETE method.
Response Parameters
basketitem_set
array
Details of basket items.
quantity
integer
Quantity of basket item.
product
dict
Details of basket item.
unit_price
string
Item unit price.
currency_type
string
Item price currency.
tax_rate
string
Tax rate.
total_amount
string
Net product price.
shipping_discount
string
Item shipping discount amount.
attributes
dict
Item attributes.
id
integer
Database ID of the item.
attributes_kwargs
dict
Item attribute keywords.
image
string
Item image.
parent
dict
If the item is a child product, details of the parent product.
offer_badges
array
Discounts.
price
string
Item price.
retail_price
string
Item price before the discount.
stock
integer
Item stock amount.
discount_amount
string
Item discount amount.
total_amount
string
Total price of basket items.
total_quantity
integer
Total quantity of basket items.
unavailable_basket_products
array
Invalid or unavailable items in the basket.
upsell_details
array
Parameters and message details if there are items whose discount prices are no longer valid or if their prices increased later.
discounts
array
Discounts.
total_discount_amount
string
Total discount amount.
total_product_amount
string
Total price of items.
voucher_code
string
Discount code.
pk
integer
Database ID of the user's basket.
created_date
string
Date when the basket was created in the database.
modified_date
string
Date when the basket was last modified in the database.
segment:
dict
Information on which segment the customer is in
Last updated
Was this helpful?