4

I am trying to get the tax amount to deduct from the total amount or just get the bare subtotal amount so i can put it in an affiliate link but I am not being able to get the tax amount or bare subtotal in the last thank you page after the customer clicks the place order button. I tried:

 <?php echo $_product->getData('tax_amount'); ?> 

and

  $totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); //total items in cart
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = round($totals["subtotal"]->getValue()); //Subtotal value
$grandtotal = round($totals["grand_total"]->getValue()); //Grandtotal value


if(isset($totals['tax']) && $totals['tax']->getValue()) {
    $tax = round($totals['tax']->getValue()); //Tax value if present
} else {
    $tax = '';
}

echo $tax;

but with no luck; I could not get the tax amount I could just get the subtotal with the tax amount.

TylerH
  • 20,799
  • 66
  • 75
  • 101
jarus
  • 1,853
  • 11
  • 44
  • 76

1 Answers1

13
Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount')

Here you will get your tax amount

Keyur Shah
  • 11,043
  • 4
  • 29
  • 48
Sandeep
  • 943
  • 1
  • 7
  • 11
  • I only get null ... I am pretty sure that the 'thank you page' / success page magento converts quotes into orders and closes the quote so no surprise, this might work in the checkout though.. but not what I was after.. – OZZIE Aug 28 '19 at 13:26