Log in
Model

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 it when they need to programmatically add products to a cart with comprehensive error handling, validation, and rollback capabilities.

It's particularly useful in GraphQL mutations, API endpoints, or custom cart management features where multiple products need to be added atomically.

Public Methods

  • execute()
  • addItemsToCart()