6

In onepage checkout, I am trying to get Grand Total but it is not updated based on shipping charges, taxes applied instead it is only showing product cost.

After selecting the shipping method and reloading the page is updating grand total correctly but I wanted to update grand total in the step payment information.

Can anybody please help me with this?

1
  • Can you please show ur code?
    – Amit Bera
    Commented Dec 3, 2015 at 9:21

3 Answers 3

9

Try

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

OR

print_r(Mage::helper('checkout')->getQuote()->getData());
11
  • I tried this only but it will not give you updated grand total, it excludes shipping charges, taxes, etc in the step of payment information.. And if I reload the page at the very moment, then it updates the grand total. Is there any way so that while moving to step payment information, it refreshes the grand total to calculate accordingly Commented Dec 3, 2015 at 9:32
  • edited my answer try that also. Commented Dec 3, 2015 at 9:38
  • Thanks a lot man, it worked!! print_r(Mage::helper('checkout')->getQuote()->getData()); Commented Dec 3, 2015 at 9:48
  • Why getting the full data array? What about $quote->getGrandTotal() or $quote->getData('grand_total')?
    – 7ochem
    Commented Dec 3, 2015 at 9:49
  • yes you can use $quote->getGrandTotal() Commented Dec 3, 2015 at 9:50
7

You can get the grand total by using this:

$grandTotal = Mage::getModel('checkout/session')->getQuote()->getGrandTotal();
0

Here is my solution and I hope this helps anyone who needs it.

By default Shipping is not added to the grandTotal until after you select your payment method. To add it after you select your shipping method go to this file.

app/design/frontend/base/default/template/checkout/onepage/payment.phtml

The code at the top is this:

var quoteBaseGrandTotal = getQuoteBaseGrandTotal(); ?>;
var checkQuoteBaseGrandTotal = quoteBaseGrandTotal;

Its picking up the BaseGrandTotal, so you simply have to switch it to GrandTotal like this:

var quoteGrandTotal = getQuoteGrandTotal(); ?>;
var checkQuoteGrandTotal = quoteGrandTotal;

Now your shipping will be add the the GrandTotal, as BaseGrandTotal excludes the shipping costs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.