I want to add 3.5% Surcharge Fee to the Total Shopping Cart Quote for using Credit Card option. Is this possible ?



3 Answers 3


Yes, that is quite possible. If you would like to show it as a separate total you could create a new total collector for surcharge fee : see here:

If you would just like to add the 3.5% surcharge without showing it as a separate component you could hook into the event: sales_quote_save_before and sales_quote_address_save_before and write code to add 4.5% surcharge to quote and address grand total

if $quoteObject->getPayment()->getMethod() == 'cc'


Here are the steps I would have followed to implement the above request -:

Step 1 -

Create two fields (surcharge and base surcharge) against quote address and order

$installer = $this;

$installer->run("ALTER TABLE  `".$this->getTable('sales/quote_address')."` ADD `surcharge` DECIMAL( 10, 2 ) NOT NULL");
$installer->run("ALTER TABLE  `".$this->getTable('sales/quote_address')."` ADD `base_surcharge` DECIMAL( 10, 2 ) NOT NULL");

$installer->run("ALTER TABLE  `".$this->getTable('sales/order')."` ADD `surcharge` DECIMAL( 10, 2 ) NOT NULL");
$installer->run("ALTER TABLE  `".$this->getTable('sales/order')."` ADD `base_surcharge` DECIMAL( 10, 2 ) NOT NULL");


Step 2 - Add the following to config.xml

<?xml version="1.0"?>

Step 3 - Create Model app\code\community\CompanyName\Surcharge\Model\Total\Quote.php


class CompanyName_Surcharge_Model_Total_Quote extends Mage_Sales_Model_Quote_Address_Total_Abstract {

    protected $_code = 'surcharge';

     * Initialize surcharge totals collector
    public function __construct()

    public function collect(Mage_Sales_Model_Quote_Address $address) 


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

        $grandTotal= Mage::getModel('sales/quote_address')->load($address->getId())->getData('grand_total');            
        $baseSurcharge = 0;
        $surcharge = 0;

        $baseSurcharge += (($grandTotal) * (3.5 / 100));
        $surcharge += Mage::app()->getStore()->convertPrice($baseSurcharge);



        return $this;

    public function fetch(Mage_Sales_Model_Quote_Address $address) {
        $amount = $address->getSurcharge();
        if ($amount > 0) {
                'code' => $this->getCode(),
                'title' => 'Surcharge',
                'value' => $amount

        return $this;

Step 4 - Create Block app\code\community\CompanyName\Surcharge\Block\Sales\Order\Total.php


class CompanyName_Surcharge_Block_Sales_Order_Total extends Mage_Sales_Block_Order_Totals {

    protected function _initTotals() {
        $surcharge = $this->getSource()->getSurcharge();
        $baseSurcharge = $this->getSource()->getBaseSurcharge();

        if ($surcharge != 0) {
            $this->addTotal(new Varien_Object(array(
                'code' => 'surcharge',
                'value' => $surcharge,
                'base_value' => $baseSurcharge,
                'label' => Mage::helper('surcharge')->getLabel(),
                    )), 'surcharge');
        return $this;

Hope the above helps but if you are not a developer then you can use the following module which can be used to address the above issue along with more flexibility -:


Cheers S

  • using above method invoice is not created for surcharge, Invoice is being created only for other than sur charge amount
    – Anto S
    Apr 3, 2016 at 11:24

In addition to the accepted answer, this new order total should also show up in transactional emails and other places.

This post explains this in details: http://excellencemagentoblog.com/blog/2012/01/27/magento-add-fee-discount-order-total/

There's also a really simple extension which lets you do this: http://www.magentocommerce.com/magento-connect/catalog/product/view/id/26312/super-simple-surcharge/

You can add a single surcharge for any payment method, shipping method or customer group. You can either calculate your surcharge based on a percentage value or use a flat value.

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.