AddProductsToCart
Magento\Quote\Model\Cart\AddProductsToCart
What it does
This class provides a unified service for adding multiple products to a shopping cart in Magento 2.
Developers use this when they need to programmatically add products to a cart, such as in GraphQL mutations, REST API endpoints, or custom cart management features.
It handles validation, error reporting, stock checking, and ensures the cart is only saved if all operations succeed or partially succeed.
Public Methods
- execute()
- addItemsToCart()