Totals
Magento\Quote\Model\Cart\Totals
What it does
This class represents the shopping cart totals data structure in Magento 2, storing all calculated amounts like grand total, subtotal, discounts, taxes, and shipping costs in both base and quote currencies.
Developers use this class to retrieve or set cart total information when working with cart APIs, displaying cart summaries, or implementing custom checkout logic.
It implements the TotalsInterface and provides getter/setter methods for all financial components of a shopping cart.
Public Methods
- getGrandTotal()
- setGrandTotal()
- getBaseGrandTotal()
- setBaseGrandTotal()
- getSubtotal()
- setSubtotal()
- getBaseSubtotal()
- setBaseSubtotal()
- getDiscountAmount()
- setDiscountAmount()
- getBaseDiscountAmount()
- setBaseDiscountAmount()
- getSubtotalWithDiscount()
- setSubtotalWithDiscount()
- getBaseSubtotalWithDiscount()
- setBaseSubtotalWithDiscount()
- getShippingAmount()
- setShippingAmount()
- getBaseShippingAmount()
- setBaseShippingAmount()
- getShippingDiscountAmount()
- setShippingDiscountAmount()
- getBaseShippingDiscountAmount()
- setBaseShippingDiscountAmount()
- getTaxAmount()
- setTaxAmount()
- getBaseTaxAmount()
- setBaseTaxAmount()
- getWeeeTaxAppliedAmount()
- setWeeeTaxAppliedAmount()
- getShippingTaxAmount()
- setShippingTaxAmount()
- getBaseShippingTaxAmount()
- setBaseShippingTaxAmount()
- getSubtotalInclTax()
- setSubtotalInclTax()
- getBaseSubtotalInclTax()
- setBaseSubtotalInclTax()
- getShippingInclTax()
- setShippingInclTax()
- getBaseShippingInclTax()
- setBaseShippingInclTax()
- getBaseCurrencyCode()
- setBaseCurrencyCode()
- getQuoteCurrencyCode()
- setQuoteCurrencyCode()
- getCouponCode()
- setCouponCode()
- getItemsQty()
- setItemsQty()
- getItems()
- setItems()
- getTotalSegments()
- setTotalSegments()
- getExtensionAttributes()
- setExtensionAttributes()