What is the Basket object lifecycle during B2C Commerce checkout?
Suggested answer
The Basket is the in-session shopping cart object managed by the dw.order.BasketMgr API. Its lifecycle during checkout:
1. Creation — when a customer first adds a product, BasketMgr.getCurrentOrNewBasket() creates a basket and associates it with the session
2. Population — cart and checkout controllers add product line items, apply coupons, set shipping address, select shipping method, and attach payment instruments to the basket
3. Validation — at each checkout step, controllers validate the basket state (e.g., inventory check, payment validation) before proceeding
4. Order placement — COPlaceOrder calls the checkout hook which calls BasketMgr.placeOrder(basket), converting the basket into a persisted Order object
5. Basket deletion — after successful order placement, the basket is automatically deleted from the session
6. Abandonment — if the session expires before checkout, the basket is abandoned and eventually purged by a platform job
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.