So, if you have ever tried to set a handling fee in Magento by percent per order, you’ll find it takes the shipping cost * the handling (even though in the docs it says it takes the order * the handling). However, I have a client who needed to have their shipping charge a percentage of the order total to recoup the cost for insurance for UPS shipping since the module doesn’t have that feature.

So, here’s how to fix this:

1. Copy /app/code/core/Mage/Shipping/Model/Carrier/Abstract.php to /app/code/local/Mage/Shipping/Model/Carrier/Abstract.php (we never want to modify the core. EVER!).

Open of that new file and replace the following line:

return ($cost * $this->_numBoxes) + ($cost * $this->_numBoxes * $handlingFee / 100);


$ordertotalforshipping = Mage::getSingleton(‘checkout/session’)->getQuote();
return ($cost * $this->_numBoxes) + ($ordertotalforshipping * $handlingFee);

Save the file.

Now, as long as you have selected the options in your shipping module, it should work.