Magento_Quote module
This module provides customer cart management functionality.
Installation
The Magento_Quote module is one of the base Magento 2 modules. You cannot disable or uninstall this module.
The Magento_Quote module creates the following table in the database:
- quote
- quote_address
- quote_item
- quote_address_item
- quote_item_option
- quote_payment
- quote_shipping_rate
- quote_id_mask
For information about a module installation in Magento 2, see Enable or disable modules.
Extensibility
Extension developers can interact with the Magento_Quote module. For more information about the Magento extension mechanism, see Magento plug-ins.
The Magento dependency injection mechanism enables you to override the functionality of the Magento_Quote module.
Events
The module dispatches the following events:
- sales_quote_address_collection_load_afterevent in the- \Magento\Quote\Model\ResourceModel\Quote\Address\Collection::_afterLoadmethod. Parameters:- quote_address_collectionis a- $thisobject (- Magento\Quote\Model\ResourceModel\Quote\Address\Collectionclass)
 
- items_additional_dataevent in the- \Magento\Quote\Model\Cart\Totals\ItemConverter::modelToDataObjectmethod. Parameters:- itemis a quote_item object (- \Magento\Quote\Model\Quote\Itemclass)
 
- sales_quote_remove_itemevent in the- \Magento\Quote\Model\Quote::removeItemmethod. Parameters:- quote_itemis a quote_item object (- \Magento\Quote\Model\Quote\Itemclass)
 
- sales_quote_add_itemevent in the- \Magento\Quote\Model\Quote::addItemmethod. Parameters:- quote_itemis a quote_item object (- \Magento\Quote\Model\Quote\Itemclass)
 
- sales_quote_product_add_afterevent in the- \Magento\Quote\Model\Quote::addProductmethod. Parameters:- itemsis an array with quot_item objects (- \Magento\Quote\Model\Quote\Itemclass)
 
- sales_quote_merge_beforeevent in the- \Magento\Quote\Model\Quote::mergemethod. Parameters:- quoteis a- $thisobject (- \Magento\Quote\Model\Quoteclass)
- sourceis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_quote_merge_afterevent in the- \Magento\Quote\Model\Quote::mergemethod. Parameters:- quoteis a- $thisobject (- \Magento\Quote\Model\Quoteclass)
- sourceis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_convert_quote_to_orderevent in the- \Magento\Quote\Model\Quote\Address\ToOrder::convertmethod. Parameters:- orderis an order object (- \Magento\Sales\Model\Orderclass)
- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_quote_item_qty_set_afterevent in the- \Magento\Quote\Model\Quote\Item::setQtymethod. Parameters:- itemis a- $thisobject (- \Magento\Quote\Model\Quote\Itemclass)
 
- sales_quote_item_set_productevent in the- \Magento\Quote\Model\Quote\Item::setProductmethod. Parameters:- productis a product object (- \Magento\Catalog\Model\Productclass)
- quote_itemis a- $thisobject (- \Magento\Quote\Model\Quote\Itemclass)
 
- sales_quote_payment_import_data_beforeevent in the- \Magento\Quote\Model\Quote\Payment::importDatamethod. Parameters:- paymentis a- $thisobject (- \Magento\Quote\Model\Quote\Paymentclass)
- inputis a data object (- \Magento\Framework\DataObjectclass)
 
- sales_quote_collect_totals_beforeevent in the- \Magento\Quote\Model\Quote\TotalsCollector::collectmethod. Parameters:- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_quote_collect_totals_afterevent in the- \Magento\Quote\Model\Quote\TotalsCollector::collectmethod. Parameters:- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_quote_address_collect_totals_beforeevent in the- \Magento\Quote\Model\Quote\TotalsCollector::collectAddressTotalsmethod. Parameters:- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
- shipping_assignmentis a shipping_assignment object (- \Magento\Quote\Model\ShippingAssignmentclass)
- totalis a total object (- \Magento\Quote\Model\Quote\Address\Totalclass)
 
- sales_quote_address_collect_totals_afterevent in the- \Magento\Quote\Model\Quote\TotalsCollector::collectAddressTotalsmethod. Parameters:- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
- shipping_assignmentis a shipping_assignment object (- \Magento\Quote\Model\ShippingAssignmentclass)
- totalis a total object (- \Magento\Quote\Model\Quote\Address\Totalclass)
 
- checkout_submit_beforeevent in the- \Magento\Quote\Model\QuoteManagement::placeOrdermethod. Parameters:- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- checkout_submit_all_afterevent in the- \Magento\Quote\Model\QuoteManagement::placeOrdermethod. Parameters:- orderis an order object (- \Magento\Sales\Model\Orderclass)
- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_model_service_quote_submit_beforeevent in the- \Magento\Quote\Model\QuoteManagement::submitQuotemethod. Parameters:- orderis an order object (- \Magento\Sales\Model\Orderclass)
- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_model_service_quote_submit_successevent in the- \Magento\Quote\Model\QuoteManagement::submitQuotemethod. Parameters:- orderis an order object (- \Magento\Sales\Model\Orderclass)
- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
 
- sales_model_service_quote_submit_failureevent in the- \Magento\Quote\Model\QuoteManagement::rollbackAddressesmethod. Parameters:- orderis an order object (- \Magento\Sales\Model\Orderclass)
- quoteis a quote object (- \Magento\Quote\Model\Quoteclass)
- exceptionis an exception object (- \Exceptionclass)
 
- prepare_catalog_product_collection_pricesevent in the- \Magento\Quote\Model\ResourceModel\Quote\Item\Collection::_assignProductsmethod. Parameters:- collectionis a product collection object (- \Magento\Quote\Model\ResourceModel\Quote\Item\Collectionclass)
- store_idis a store ID (- inttype)
 
- sales_quote_item_collection_products_after_loadevent in the- \Magento\Quote\Model\QuoteManagement::_assignProductsmethod. Parameters:- collectionis a product collection object (- \Magento\Catalog\Model\ResourceModel\Product\Collectionclass)
 
For information about an event in Magento 2, see Events and observers.
Public APIs
Data
- \Magento\Quote\Api\Data\AddressAdditionalDataInterface- provides additional data with quote address information
 
- \Magento\Quote\Api\Data\AddressInterface- quote address data
 
- \Magento\Quote\Api\Data\CartInterface- quote data
 
- \Magento\Quote\Api\Data\CartItemInterface- quote item data
 
- \Magento\Quote\Api\Data\CartSearchResultsInterfac- quote search result data
 
- \Magento\Quote\Api\Data\CurrencyInterface- currency data
 
- \Magento\Quote\Api\Data\EstimateAddressInterface- estimate address data
 
- \Magento\Quote\Api\Data\PaymentInterface- payment data
 
- \Magento\Quote\Api\Data\PaymentMethodInterface- payment method data
 
- \Magento\Quote\Api\Data\ProductOptionInterface- product option data
 
- \Magento\Quote\Api\Data\ShippingAssignmentInterface- shipping assigment data
 
- \Magento\Quote\Api\Data\ShippingInterface- shipping data
 
- \Magento\Quote\Api\Data\ShippingMethodInterface- shipping method data
 
- \Magento\Quote\Api\Data\TotalsAdditionalDataInterface- provides additional data for totals collection
 
- \Magento\Quote\Api\Data\TotalSegmentInterface- total segment data
 
- \Magento\Quote\Api\Data\TotalsInterfacee- quote totals data
 
- \Magento\Quote\Api\Data\TotalsItemInterface- quote items totals data
 
General
- \Magento\Quote\Api\ChangeQuoteControlInterface- checks if user is allowed to change the quote
 
Guest
- \Magento\Quote\Api\GuestBillingAddressManagementInterface- assigns a specified billing address to a specified quote
- gets the billing address for a specified quote
 
- \Magento\Quote\Api\GuestCartItemRepositoryInterface- gets lists items that are assigned to a specified quote
- add/update the specified cart guest item
- removes the specified item from the specified quote
 
- \Magento\Quote\Api\GuestCouponManagementInterface- gets coupon for a specified quote by quote ID
- adds a coupon by code to a specified quote
- deletes a coupon from a specified quote by quote ID
 
- \Magento\Quote\Api\GuestCartManagementInterface- gets list items that are assigned to a specified quote
- add/update the specified quote item
- deletes the specified item from the specified quote
 
- \Magento\Quote\Api\GuestPaymentMethodManagementInterface- adds a specified payment method to a specified shopping quote
- gets the payment method for a specified shopping quote
- gets list available payment methods for a specified shopping quote
 
- \Magento\Quote\Api\GuestShipmentEstimationInterface- estimates shipping by address and return list of available shipping methods
 
- \Magento\Quote\Api\GuestShippingMethodManagementInterface- gets list applicable shipping methods for a specified quote
- estimates shipping
 
- \Magento\Quote\Api\GuestCartRepositoryInterface- gets quote by quote ID for guest user
 
- \Magento\Quote\Api\GuestCartTotalManagementInterface- sets shipping/billing methods and additional data for a quote and collect totals for guest
 
- \Magento\Quote\Api\GuestCartTotalRepositoryInterface- gets quote totals by quote ID for guest user
 
- \Magento\Quote\Model\GuestCart\GuestShippingAddressManagementInterface- assign a specified shipping address to a specified quote
- gets the shipping address for a specified quote
 
- \Magento\Quote\Model\GuestCart\GuestShippingMethodManagementInterface- sets the carrier and shipping methods codes for a specified quote
- gets the selected shipping method for a specified quote
 
Registered customer
- \Magento\Quote\Api\BillingAddressManagementInterface- assigns a specified billing address to a specified quote
- gets the billing address for a specified quote
 
- \Magento\Quote\Api\CartItemRepositoryInterface- gets lists items that are assigned to a specified quote
- add/update the specified quote item
- removes the specified item from the specified quote
 
- \Magento\Quote\Api\CartManagementInterface- creates an empty quote and quote for a guest
- creates an empty quote and quote for a specified customer if customer does not have a quote yet
- returns information for the quote for a specified customer
- assigns a specified customer to a specified shopping quote
- places an order for a specified quote
 
- \Magento\Quote\Api\CartRepositoryInterface- gets quote by quote ID
- gets list carts that match specified search criteria
- gets quote by customer ID
- gets active quote by quote ID
- gets active quote by customer ID
- saves quote
- deletes quote
 
- \Magento\Quote\Api\CartTotalManagementInterface- sets shipping/billing methods and additional data for quote and collect totals
 
- \Magento\Quote\Api\CartTotalRepositoryInterface- gets quote totals by quote ID
 
- \Magento\Quote\Api\CouponManagementInterface- gets coupon for a specified quote by quote ID
- adds a coupon by code to a specified quote
- deletes a coupon from a specified quote by quote ID
 
- \Magento\Quote\Api\PaymentMethodManagementInterface- adds a specified payment method to a specified shopping quote
- gets the payment method for a specified shopping quote
- gets list available payment methods for a specified shopping quote
 
- \Magento\Quote\Api\ShipmentEstimationInterface- estimates shipping by address and return list of available shipping methods
 
- \Magento\Quote\Api\ShippingMethodManagementInterface- estimates shipping by quote ID an Address
- estimates shipping by quote ID an address ID
- get lists applicable shipping methods for a specified quote
 
- \Magento\Quote\Model\ShippingAddressManagementInterface- assigns a specified shipping address to a specified quote
- gets the shipping address for a specified quote
 
- \Magento\Quote\Model\ShippingMethodManagementInterface- sets the carrier and shipping methods codes for a specified quote
- gets the selected shipping method for a specified quote
 
Model
- \Magento\Quote\Model\Quote\Address\FreeShippingInterface- checks if is a free shipping
 
- \Magento\Quote\Model\Quote\Address\RateCollectorInterface- retrieves all methods for supplied shipping data
 
- \Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface- converts masked quote ID to the quote ID (entity ID)
 
- \Magento\Quote\Model\QuoteIdToMaskedQuoteIdInterface- converts quote ID to the masked quote ID
 
For information about a public API in Magento 2, see Public interfaces & APIs.

