Shopping cart lifecycle and pricing.The cart holds a customer’s selected items before order creation. It may be associated with an authenticated customer, an anonymous session, or both; verify the implemented identity model.
Typical operations
Retrieve the current cart.
Add an item and quantity.
Update quantity or remove an item.
Revalidate price, stock, product status, and promotions.
Calculate subtotal, discounts, tax, shipping estimates, and payable total.
Important rules
The server must recalculate all monetary values. Treat client-submitted price, discount, tax, and total fields as untrusted. Revalidate cart lines at checkout because catalogue prices and stock can change. Ensure duplicate add requests and retries do not create unintended quantities.