Jump to content

Add tax on COD payment


Recommended Posts

I would override the Cart::getOrderTotal method

 

Grab the total by calling the original one (parent::getOrderTotal)

 

Then, create something like a 'getFee' method.

 

Inside this, run a debug backtrace

		$dlist=debug_backtrace(false);
        $dlist=array_reverse($dlist);

        foreach($dlist AS $trace){
            if(isset($trace['file']) && stristr($trace['file'], 'modules')){
                $name=explode(DIRECTORY_SEPARATOR, $trace['file']);
                $names[]=pSQL($name[array_search('modules', $name)+1]);
            }
        }

If names[0] equals 'cashondelivery' then add the fee (return the total plus fee)

Link to comment
Share on other sites

×
×
  • Create New...