Getting the grand total from Magento shopping cart

Getting the grand total, the final checkout price after all discounts and taxes are applied.

$quote = Mage::getModel('checkout/session')->getQuote();
$quoteData= $quote->getData();

Caculating the grand total without the promotion rules.

$quote = Mage::getModel('checkout/session')->getQuote();
$grandTotal = 0;
foreach ($quote->getAllItems() as $item) {
 $grandTotal += $item->getPriceInclTax()*$item->getQty();

This code will show all available shopping cart related values.

$quote = Mage::getModel('checkout/session')->getQuote();

Note: Shipping cost are not included in the above grand totals.


What is ‘checkout/session’?

‘checkout/session’ tells the function Mage::getModel where to look for the Model class. In this case, checkout is the module name, session is the model class name. Mage::getModel('checkout/session') will return the instance of the class Mage_Checkout_Model_Session, which resides in app/code/core/Mage/Checkout/Model/Session.php

Search within Codexpedia

Custom Search

Search the entire web

Custom Search