Bhavesh Godhani
Bhavesh Godhani

Reputation: 378

Can't set 0% tax rate

I'm using a fairly new Magento 1.8.0.0 installation, with no changes to the core. When trying to make a tax rate at 0%, Magento returns the following error upon save: Rate Percent should be a positive number.

Is this just a bug in Magento 1.8, keeping me from setting a tax rate with 0% tax, or am I missing something?

Upvotes: 0

Views: 353

Answers (2)

Anurag Prashant
Anurag Prashant

Reputation: 1014

You need to override app\code\core\Mage\Tax\Model\Calculation\Rate.php

<config>
<global>
    <models>
        <mypackage_mymodule>
            <class>MyPackage_MyModule_Model</class>
        </mypackage_mymodule>
        <tax>
            <rewrite>
           <calculation_rate>MyPackage_MyModule_Model_Calculation_Rate</calculation_rate>  
            </rewrite>
        </tax>
    </models>
</global>

Create a new rate.php and copy from app\code\core\Mage\Tax\Model\Calculation\Rate.php

rewrite your piece of code.

That's how I have done. :) :) hope this helps.

Upvotes: 1

Bhavesh Godhani
Bhavesh Godhani

Reputation: 378

So it seems that this behavior (introduced in CE 1.8.0.0 - it works as expected in CE 1.7.0.2) will be removed.

In the meantime you could try to rewrite app/code/core/Mage/Tax/Model/Calculation/Rate.php and remove these lines:

if (!is_numeric($this->getRate()) || $this->getRate() <= 0) {
        Mage::throwException(Mage::helper('tax')->__('Rate Percent should be a positive number.'));
    }

Instead you also could change the code to test for $this->getRate() < 0 instead of $this->getRate() <= 0.

It's working.

Upvotes: 0

Related Questions