Totals
Magento\Quote\Model\Cart\Totals
What it does
This class represents the cart totals data structure in Magento 2's shopping cart.
Developers use it to retrieve or set calculated totals like grand total, subtotal, tax amounts, discounts, and shipping costs in both base and quote currencies.
It's commonly used when displaying cart summaries, implementing custom checkout logic, or integrating with payment/shipping methods that need total information.
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()