Magento Certified Developer GuideCategory: 8. CheckoutHow you can customize total models
Manish Prakash Staff asked 2 years ago

Totals Models are defined in config.xml file e.g if you open sales/config.xml you will see many totals module defined there


similarly totals for order_invoice, creditmemo etc are defined there.
All total model classes should extend Mage_Sales_Model_Quote_Address_Total_Abstract
and class should have a code and define “fetch()” , “collect()” function

class Module_Model_Quote_Address_Total_Custom extends Mage_Sales_Model_Quote_Address_Total_Abstract{
   public function __construct(){

  public function collect($address){
   //this function is used add/subtract price from order totals  

   $items = $address->getAllItems();
        if (!count($items)) {
            return $this;

    //above code basically works only for billing address, if this code is not added your total will add up 2 times
    return $address;

  public function fetch($address){
     //this class is used for display purposes
return $address;


To customize a total’s model you can either override if from config.xml or create a new one as described above.