I'm trying to get the tax rate (just the value) for a product. I can get the Tax Class Id doing $product->getTaxClassId().

It seems incredible, but I can't find the way to get the value. Not the Price with the included tax or the tax amount but the percentage applied to the final price.

Can anyone help?

Thanks in advanced.

2 Answers 2


To get the tax rate you need to perform a tax request. That can be done with the following code.

$store = Mage::app()->getStore('default');
$taxCalculation = Mage::getModel('tax/calculation');
$request = $taxCalculation->getRateRequest(null, null, null, $store);
$taxClassId = $product->getTaxClassId();
$percent = $taxCalculation->getRate($request->setProductClassId($taxClassId));

Here you take the store and make a tax calculation request. You can also specify shipping address, billing address and customer tax class id but in this case I have set them to null and it will take the default values set-up in the admin configuration tax section.

You then take the tax rate request object and assign the product class id, which you already have and then you can ask for the rate itself.

  • Thank you David. I was trying others code snippets with no result, but you are the man!
    – Pymoo
    May 2, 2014 at 7:35
  • I used this, but I only needed the info for one of my stores (creating a google product feed) and ran into trouble using the store id in the getRateRequest() method, as its looking for a store object and not the store Id. I substituted the store id for 'default' in the getStore() method and all is well. thanks.
    – Jon
    Jul 27, 2015 at 22:32
public function __construct(        
        \Magento\Tax\Model\Calculation $taxCalculation,
        \Magento\Store\Model\StoreManagerInterface $storeManager
    ) {
        $this->taxCalculation = $taxCalculation;
        $this->_storeManager = $storeManager;        

function getTaxPercentage(){
       // Tax Calculation
          $productTaxClassId = $product->getTaxClassId();
          $defaultCustomerTaxClassId = $this->scopeConfig->getValue('tax/classes/default_customer_tax_class');
          $store      = $this->_storeManager->getStore(); 
          $request = $this->taxCalculation->getRateRequest(null, null, null, $store);
          $taxPercent = $this->taxCalculation->getRate($request->setProductClassId($productTaxClassId))
  • Question was for M1
    – sv3n
    Jan 4, 2021 at 19:24

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.