I need to charge some extra fee if order subtotal lessthan or equal to 100$ in my magento site. i found a solutions to changing core files. but is there any chance to write code in local folder without touching the core files.

Thanks, murali.

  • 1
    This sounds like a custom tax, I would look in to implementing a tax type for all zip codes based on these rules.
    – philwinkle
    Commented Apr 3, 2013 at 13:14
  • Why dont you try surcharge extension magecomp.com/magento-surcharge.html Commented Apr 22, 2017 at 4:47

6 Answers 6


I'd suggest going with another solution, the task to create this module is pretty big. The module touches a lot of area's that deal with price, exporting orders to account packages, credit memo's, shipments, invoices, transactional emails etc.

The way I'd implement this is to add an extra fee to the shipping costs. If that isn't an option, go with a stock module, something like: http://www.magentocommerce.com/magento-connect/low-order-fee.html (I haven't tested the module, just googled).


You can check my free and open source extension. This extension based on Shopping Cart Price Rule functionality. You can specify extra fee and it will apply if condition will match.

  • Doesn't modify core files. Implemented in local scope.
  • This Module add new total collector. It handles extra fee for totals.
  • Doesn't break discount functionality.
  • Module follows Magento Coding Standards

GitHub: https://github.com/yvoronoy/magento-extension-extra-fee

Extra Fee Based on Shopping Cart Price Rule

  • This is really nice... Saved my hours... Thank you very much..
    – Dolly
    Commented Mar 11, 2016 at 12:04
  • Amazing. This is what I've been looking for.
    – KiD Cajes
    Commented Jun 23, 2016 at 7:19
  • @JeevaRathinam You can choose it on Apply Dropbox field Commented Nov 15, 2016 at 14:27
  • @YaroslavVoronoy i.imgur.com/oMMb56y.png
    – Gem
    Commented Nov 16, 2016 at 6:49
  • @YaroslavVoronoy After entering extra fees amount like 15, then click save the entered amount 15 is gone, its not saving, like empty value. How can i solve this error?
    – Gem
    Commented Sep 5, 2018 at 9:59

I just this past week created an additional fee line item and added it to the totals sections of various pages. I used the module available for download on the following link, it worked out perfectly =]


  • yes i am using this code. but i need to apply this fee to min cart amount. but in the above code i am unable to restrict this with shopping cart sub total. do you have any idea about this? this fee should apply when cart amount lessthan 100$. here app\code\local\Excellence\Fee\Model\Sales\Quote\Address\Total\fee.php how can i restrict this fee with cart subtotal.
    – krishna
    Commented Apr 4, 2013 at 9:31

Well, we made a different approach and created a simple extension, that is based on discount in shopping cart rules. It just removes restriction for negative discount values. It doesn't change core files, but makes a few core class rewrites.

Extra Charge for Cart Rules


I have just implemented a custom pricing scheme like you want, I have changed no core file only template files has been changed. From admin I have used matrixrates and added all the prices schemes in the CSV and upload the CSV. Now I can see all the methods on the cart and onepage. Then I modified the template files to display some methods for above 350$ and some for bellow $350. It does not need any other changes because the user will select one and it will be applied to the order. the code I have used is.

First I have to find the subtotal.

if(Mage::getSingleton('checkout/cart')->getQuote()->getSubtotal() > 350){

    $above = true;

Then in the loop displaying the methods I have created some filters like.

<?php foreach ($_rates as $_rate): 
   if($above && strpos($shippingCode, 'matrixrate') === false):

Also in your case if any of the core file is involed then you can make the same directory in code/local/ and copy the file and change it. It will be overwritten.


If taxes are not option for you then you should:

  • create a extension base
  • add attributes to order, quote , invoice , creditmemo quote_address entities to store the base and converted value of your total
  • implements at least one totals class that extends Mage_Sales_Model_Quote_Address_Total_Abstract (you might want to add and extend for creditmemo, invoice etc)
  • implements at least collect and fetch methods (See from abstract you can add your conditions here against total amount etc) from Mage_Sales_Model_Quote_Address_Total_Abstract
  • adds a sort order for totals object sales/total_sort config node
  • thanks for your sugguestion. here i am following exactly like excellencemagentoblog.com/magento-add-fee-discount-order-total. this is same as you told. in this i need to restrict this fee amount with min cart amt. if cart subtotal less than 100$ then only fee should apply. but in the above code here app\code\local\Excellence\Fee\Model\Sales\Quote\Address\Total\fee.php how can i restrict this fee with cart subtotal. here i am getting 'zero' subtotal. so i am unable to check the condition here to apply this fee.
    – krishna
    Commented Apr 4, 2013 at 9:41
  • if you dump quote there all things are 0? maybe quote is not calculated jet?
    – Anton S
    Commented Apr 4, 2013 at 10:21
  • thanks for your reply. probably you are right. but still the question remains how do i get cart amount. then only i can restrict fee amount. i am trying a lot of ways but i couln't restrict this.
    – krishna
    Commented Apr 4, 2013 at 10:40
  • if i use this code in app\code\local\Excellence\Fee\Model\Sales\Quote\Address\Total\fee.php //////////////////// $totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals(); $subtotal1 = $totals["subtotal"]->getValue(); var_dump($subtotal1); ////////////////////////
    – krishna
    Commented Apr 4, 2013 at 10:55
  • the dump is producing two values first is float value with correct amount and next time it is int(0). so how can i get correct cart amount both times. so at the restriction time we are getting null value. so we are unable to restrict fee amount
    – krishna
    Commented Apr 4, 2013 at 10:55

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.