Are you using the Local Sales Tax module? If so, this is where your problem lies. The Local Sales Tax module ignores any coupons or discounts, and just adds the Tax and Shipping to the Order SubTotal, and makes this the Order Total.
The update you need is:
Find this line of code within includes/modules/order_total/ot_local_sales_tax.php
$taxRateLocal = $taxResult->fields['local_tax_rate'];
And add teh follwoing code after:
$order_discount = ($order->info['shipping_cost'] + $order->info['subtotal']) - $order->info['total'];
if ($order_discount > 0) {
$debug2 .= 'Order total '.$order->info['total'].'<br />';
$percentage_discount = ($order->info['total'] / ($order->info['total'] + $order_discount));
$debug2 .= '<b>Percentage Discount</b>'.$percentage_discount.'<br />';
} else {
$percentage_discount = 1;
}
$taxable_amount = $percentage_discount * ($Taxable_Subtotal + ($order->info['shipping_cost'] * (int)$ot_local_sales_taxes_charge_tax_on_shipping));
A few lines further down you'll find
//use zen cart tax function to calculate the tax (Taxable subtotal + shipping if needed)
$LocalTaxTotal = zen_calculate_tax(.........
Replace this with
//use zen cart tax function to calculate the tax (Taxable subtotal + shipping if needed)
$LocalTaxTotal = zen_calculate_tax($taxable_amount, $taxRateLocal);
Finally, below this, find
$order->info['total'] = $order->info['shipping_cost'] + $order->info['subtotal'] + $order->info['tax'];
And replace it with
$order->info['total'] += $order->info['tax'];
As with all updates, BACKUP first!
Absolute
Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store