Problems after disabling Weee module on Magento with developer mode on

Posted on Categories:Magento, PHP, MySQL

When doing Magento optimization, developers are often finding ways to boost performance by turning off some of the core modules that are not needed. There are multiple sites that provide recommendations on what modules should be disabled if not needed. Weee was one of them.
During development of payment method I encountered one issue related to this.

When Weee module is disabled, Magento no longer writed Weee calculations in the sales_flat_order_item table, so the fields weee_tax_applied, base_weee_tax_applied_amount, etc will not be filled in and will remain NULL by default.
This will cause problems when trying to execute $payment->registerCaptureNotification() method, because this ultimately leads to calling this method:

app/code/core/Mage/Sales/Model/Order/Item.php:getDiscountAppliedForWeeeTax()

Here Magento tries to do a foreach through values serialized in wee_tax_applied column. The foreach will throw an Warning, which Magento will pick up and throw an exception, and your order will go to hell :)

When Magento developer mode is turned off, this will present no problem, but during development this might make you loose some hours figuring out what happened.

So, moral of the story is: do not turn off Weee module.