Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.


Order Total module, add a fixed discount code, causes total to go into negatives

Recommended Posts

Hello Everyone, 


I have been through a lot of forums trying to find a solution to this, and no one else seems to have the same issue I am. 


I have order total Discount Code v2.6 installed. 


Everything is working fine, except when you enter the code for a set price discount, if the customer is purchasing items that total less then the voucher it makes the total into a negative amount. 




items equal : 62.20

discount:       100.00

vat amount:  10.37

total:              -37.80


I have seen on some posts a mention of 'Allow negative order total?' but my version doesnt provide this option.. 


is this something i can add to my module? If so, any clues would be a massive help! 


Thanks guys! 

Share this post

Link to post
Share on other sites

Hi Erika


It's gonna be difficult to help without looking at the actual code of that module.

But let's try something...


inside your ot_discount.php file you should have the following code around line 96

$order->info['total'] -= $discount;

replace that with the following code provided by marcochiana

if ($discount > $order->info['subtotal']) {
$discount = $order->info['subtotal'];
$order->info['total'] -= $discount;
} else {
$order->info['total'] -= $discount;

Not sure if that will work for you but give it a try and report back. Just make sure to back up that ot_discount.php file just in case.

Share this post

Link to post
Share on other sites

That fixed it! 


Clearly i didnt look hard enough! Could you link me to where i could find this code provided by marcochiana? 


Your a star - thank you! 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now