I have a custom attribute added to the customer model indicating weather we want to apply the tax or not. That attribute returns a boolean. I want to intercept in the way of where magento applies tax rules to the quote object & remove the tax rules if the attribute is set.

As far as i could understand Mage_Tax_Model_Sales_Total_Quote_Tax::collect is the one responsible for calculating taxes & setting them onto quote object. I think re-writing it might be able to somehow exclude that quote from taxes. but don't know how to proceed from here.

Also maybe the event sales_quote_collect_totals_before or sales_quote_collect_totals_after called from inside Mage_Sales_Model_Quote::collectTotals should be able to work. These events pass on the quote object itself. But again i don't know how to proceed.

Any pointers?


The customer group method would certainly be the cleanest, but if you are already using the groups for other purposes, you can do it programmatically as you suggest.

You would be looking to set the tax_percent, tax_amount, and base_tax_amount on the quote item.

If you do this by over-riding the tax total collector you can over-ride the percentage in:


You'll see $item->setTaxPercent($rate); towards the top. Further down you'll see

$item->setTaxAmount(max(0, $rowTax));
$item->setBaseTaxAmount(max(0, $baseRowTax));

After which you can over-ride the raw amounts.

The advantage in doing it in the collector is that you don't have to also deal with all of the row totals and overall totals on the quote object, they'll adjust automatically. The downside (potentially a big deal) is that you're doing an over-ride deep in the heart of Magento and you'll have to diff the method every time you upgrade to ensure that you're not missing bug fixes or causing a regression on upgrade.

The advantage of using the observer would be that you're more upgrade proof, but you'll have to reset the row totals and overall totals on the quote object (5-10 additional fields).


Why don't you use the basic Magento tax configuration with different customer groups. On this customer group you can configure different tax rates. This is how we use the calculation for orders outside the Netherlands where we can ship is with 0% tax.

Our setup is as follows:

We have 2 Customer Groups:

  • General that has Tax Class: NL Customer
  • General (EU) that has Tax Class: EU Customer

The tax rules are then configured like:

  • The customer tax class NL Customers for the Shippable Goods (product tax class) has the normal tax rates for the countries we allow.
  • The customer tax class EU Customers for the Shippable Goods has the 0% TAX rules applied.
  • 1
    It's because the customer groups(around 100) are already there & being used at other parts of site. We couldn't risk breaking something else. – Mridul Aggarwal Sep 6 '13 at 20:24

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.