Model
Cart
Magento\Checkout\Model\Cart
What it does
The Cart model manages shopping cart operations in Magento 2, providing methods to add, update, and remove products from the cart.
Developers use this class when building custom cart functionality, processing product additions/updates, or implementing cart-related features in extensions.
It acts as a wrapper around the Quote model, handling cart operations with proper event dispatching and validation.
Public Methods
- getCheckoutSession()
- getCustomerSession()
- getItems()
- getQuoteProductIds()
- getQuote()
- setQuote()
- addOrderItem()
- addProduct()
- addProductsByIds()
- suggestItemsQty()
- updateItems()
- removeItem()
- save()
- saveQuote()
- truncate()
- getProductIds()
- getSummaryQty()
- getItemsCount()
- getItemsQty()
- updateItem()