I wish to change the tax amount in checkout programmatically I am using following code let me know If I am making any mistake.

$session= Mage::getSingleton("checkout/session");
$quote_id = $session->getQuoteId();
$quote = Mage::getModel("sales/quote")->load($quote_id);
$items = $quote->getAllItems();
foreach($items as $item) { 
  • you use this code inside event observers? – saravanavelu Apr 11 '15 at 5:09
  • I am using it in Model file – Pratik bhatt Apr 11 '15 at 5:14
  • ok. Can you try with this event sales_quote_collect_totals_after – saravanavelu Apr 11 '15 at 5:30
  • But I want to change this before placing order and only on checkout page – Pratik bhatt Apr 11 '15 at 5:36
  • yes you can the tax with the above events – saravanavelu Apr 11 '15 at 5:38

After Long research and trials Finally I come up with this solution.

$finalPrice = $product->getPrice();
    $item = Mage::getSingleton('checkout/session')->getQuote()->getItemByProduct($product);
    $finalprice = $finalPrice - $item->getTaxAmount();
    $quote = Mage::getModel('checkout/session')->getQuote();
    $address = $quote->getShippingAddress();
    if ($address)
    {   $address->setSubtotalInclTax($finalprice);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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