2

I can get tax amount by

$order->getTaxAmount();

But how can I get tax name applied to order.

I used this

$taxClassId = $order->getTaxClassId();
$taxClassName = Mage::getModel('tax/class')->load($taxClassId)->getClassName();

But it is not working.

Any help.

4

Order data doesn't hold tax class id (check what can you get from order regarding tax), which is why you cannot get it from there. But you can work around to it.

You can call tax class this way:

$items = $order->getAllItems();
foreach($items as $item){
   $productId = $item->getProductId();
   $_product = Mage::getModel('catalog/product')->load($productId);
   $taxClassId = $_product->getTaxClassId();
   $taxClass = Mage::getModel('tax/class')->load($taxClassId);
   $taxClassName = $taxClass->getClassName();
   echo $taxClassName."<br>";
}

Since tax class is applied to individual product in magento, it may have different class for different products within a order.

Here we are going through each item in order and then getting tax class of those items.

Hope this helps.

  • Can you answer this @AdarshKhatri magento.stackexchange.com/questions/119706/… – Jatin Raikwar Jun 7 '16 at 10:38
  • But tax class id for a product can be changed and if you want to get info from an old order/item you get the wrong value ... I am not sure how it works but tax class are recorded here for every order_item sales_order_tax_item – Fra Aug 10 '17 at 15:49
  • $order->getFullTaxInfo() this might have the code right? – arqam Sep 30 at 11:20

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.