Virtuemart Coupon Tax Error in Initial Basket


In Virtuemart, there is a tax error on the initial basket page after entering a coupon. In a fresh installation of Virtuemart (in this case 1.1.5), I enter a product as below

Then I add a coupon that gives me 80% off.

As you can see, the tax total is the same, which only confuses the user. If you click to checkout, this error fixes itself, but from a customer point of view it is confusing and incorrect.

The Solution

The solution is actually very simple, so simple that I almost missed it. There is a variable scoping problem within the code. A parent file calls a class file. Within the class file, a global variable ($vars) is edited and passed back to the parent file which is then used to calculate the tax. The problem is the edit within the class is not saved. This happens because the variable is not defined as a global variable in the parent file. To fix this:

In www/administrator/components/com_virtuemart/html/basket.php
On or around line 28 is this
__FILE__ );

Right after that declaration, add the following code to make $vars global
__FILE__ );

You are done. Now your initial basket should contain the correct thax.


  1. blaauw
    john71 5 years ago
    Great, my problem is solved!
    Good job, thank you, John
  2. blaauw
    Guest 5 years ago
    Use of coupon shows incorrect price until very end of checkout

    I bought the awo pro, i made a coupon for my site but now all my coupons, even the originals from the standard virtuemart coupon area are broke. I made a coupon for 40% off all products. But during checkout it calculates the prices as 80% off. very confusing to customers. at the final checkout the price shows right but all the steps leading up to it are wrong. What could this be????

    • blaauw
      seyi 5 years ago
      Please take a look at this thread:
  3. blaauw
    Guest 4 years ago
    This does not seem to fix the error in VM 1.1.7? Same tax is being calculated on the retail cost and ignores the discount.

    There are a set of variables listed as:

    global $weight_total, $total, $tax_total, $order_tax_details, $discount_factor, $order_total;

    Perhaps your variable for AWO needs to be added here? Please advise.
  4. blaauw
    Guest 4 years ago

    I researched further and found a solution on your forum. I CHECKED-OFF subtract payment discount before tax in the VM configuration and that did the trick.

    Thanks for the support.