Friday, December 28, 2012

MAGENTO, How to find Product Tax Rate OR Tax Percentage

## MAGENTO, How to find Product tax rate

foreach ($productIds as $productId) {
$_product = Mage::getModel('catalog/product')->load($productId);
$productsPrice = floatval($_product->getData("price"));

// Get the product's tax class' ID
$taxClassId = $_product->getData("tax_class_id");
echo 'Tax Class ID '.$taxClassId.'
// Get the tax rates of each tax class in an associative array
$taxClasses = Mage::helper("core")->jsonDecode( Mage::helper("tax")-        
>getAllRatesByProductClass() );
echo 'Tax Classes '.$taxClasses.'

// Extract the tax rate from the array
$taxRate = $taxClasses["value_".$taxClassId];
echo 'Tax Rate '.$taxRate.'