Virtuemart discount amount WITH tax

frederic11
140 Posts
frederic11 posted this 10 May 2020

Hello,
i have a little problem. I want to show the discount amount of a product, but WITH tax.

As you can see here, the discount amount is 10%, but actually, it is without tax. I want to show the amount WITH tax.
https://lampedesign.ch/index.php/manufacturer/baltensweiler

The code i have is only without tax and i cant figure out how make it work with tax.

Hello, i have a little problem. I want to show the discount amount of a product, but WITH tax. As you can see here, the discount amount is 10%, but actually, it is without tax. I want to show the amount WITH tax. https://lampedesign.ch/index.php/manufacturer/baltensweiler The code i have is only without tax and i cant figure out how make it work with tax.
Vote to pay developers attention to this features or issue.
3 Comments
Order By: Standard | Newest
Support Team
Support Team posted this 22 May 2020

Hello,

Unfortunately there is no ready code for this. As a possible trick we can recommend to play with calculation rules and make the needed amount appear - if possible. Also there can be some codes on Virtuemart forums or some ideas to create a code by analogy.

Sincerely,
Nettie

Hello, Unfortunately there is no ready code for this. As a possible trick we can recommend to play with calculation rules and make the needed amount appear - if possible. Also there can be some codes on Virtuemart forums or some ideas to create a code by analogy. Sincerely, Nettie
frederic11
140 Posts
frederic11 posted this 28 May 2020

Hello,
ok, i saw with Virtuemart forum, and have a solution, this is the code i have to put :

<?php
if(!(isset($currency))){
$currency = CurrencyDisplay::getInstance ();
}
$dis = $product->prices['discountAmount'] *1.077;
echo '<span class="price-crossed">'.$currency->getFormattedCurrency ($dis, 2).'</span>';
?>

In my case, the tax is 7.7%, so have to change the calcul x1.077 depending of the tax you have.

Regards

Hello, ok, i saw with Virtuemart forum, and have a solution, this is the code i have to put : <?php if(!(isset($currency))){ $currency = CurrencyDisplay::getInstance (); } $dis = $product->prices['discountAmount'] *1.077; echo '<span class="price-crossed">'.$currency->getFormattedCurrency ($dis, 2).'</span>'; ?> In my case, the tax is 7.7%, so have to change the calcul x1.077 depending of the tax you have. Regards
aswetnatex
2 Posts
aswetnatex posted this 15 May 2026

In VirtueMart, the discount amount is typically calculated on the base price, which is why it appears without tax by default. To display the discount including tax, you need to ensure that the tax calculation is applied after the discount value is computed, or adjust the pricing helper to use the final price with tax (depending on your setup). In many cases, this can be handled by modifying the product price display function or using VirtueMart’s built-in configuration for “show prices with tax” so that discount calculations inherit the tax-inclusive value. If you are working with custom code overrides, you may need to multiply the discount amount by the tax rate or use the final taxed price object instead of the base price object. Just like digital systems such as the ORUS account streamline financial and tax-related data handling in one structured platform, VirtueMart also relies on structured pricing layers where tax, discount, and final price are processed separately, so adjusting the correct layer is key to achieving accurate display.

In VirtueMart, the discount amount is typically calculated on the base price, which is why it appears without tax by default. To display the discount including tax, you need to ensure that the tax calculation is applied after the discount value is computed, or adjust the pricing helper to use the final price with tax (depending on your setup). In many cases, this can be handled by modifying the product price display function or using VirtueMart’s built-in configuration for “show prices with tax” so that discount calculations inherit the tax-inclusive value. If you are working with custom code overrides, you may need to multiply the discount amount by the tax rate or use the final taxed price object instead of the base price object. Just like digital systems such as the [ORUS][1] account streamline financial and tax-related data handling in one structured platform, VirtueMart also relies on structured pricing layers where tax, discount, and final price are processed separately, so adjusting the correct layer is key to achieving accurate display. [1]: https://orus.ph/
You must log in or register to leave comments