[Skip to main content](#vessel-content)

#   Apply discounts before taxes doesnt work correctly

##

- **[Savickis](/forum/user/26490-savickis "View Savickis's Profile")**
- [![Savickis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26490.jpg)](/forum/user/26490-savickis "View Savickis's Profile") Topic Author
- [ Offline](/forum/user/26490-savickis)

Less More

- Posts: 41
- Thank you received: 9
-
-

13 years 3 weeks ago -  13 years 3 weeks ago [\#130782](#130782) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#130782 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")* was created by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")*

-- url of the page with the problem -- : http://pastastacija[dot]lv/lv/ieg%C4%81d%C4%81ties-kodu
-- HikaShop version -- : HikaShop Business 2.2.2
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.24

Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option "Apply discounts After/Before taxes" doesn't work as it should. Please see attached order invoice as it's generated now:

[ ![h1b8fa44.png](/forum/attachment/13429) ](/forum/attachment/13429 "h1b8fa44.png")

You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.

Of course, I could just edit *attachinvoice/invoice.php* to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...

Thanks for helping sort this out in advance.
Best regards, Arthur
.

- [ ![h1b8fa44.png](/forum/attachment/13429) ](/forum/attachment/13429 "h1b8fa44.png") [ ](/forum/attachment/13429?download=1 "h1b8fa44.png")

Last edit: 13 years 3 weeks ago by [Savickis](/forum/user/26490-savickis "View Savickis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

13 years 3 weeks ago [\#130848](#130848) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#130848 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")*

Hi,

There are several ways to calculate the amount of a coupon based on the taxes or not.
First, you have the option "Apply discounts" of the configuration that you can change.
Then, in the options of the coupon itself, you have the "tax category" option that you can change.
You should try the different combinations of these two options. One of them should allow the system to calculate the taxes/coupon value like you want.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Savickis](/forum/user/26490-savickis "View Savickis's Profile")**
- [![Savickis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26490.jpg)](/forum/user/26490-savickis "View Savickis's Profile") Topic Author
- [ Offline](/forum/user/26490-savickis)

Less More

- Posts: 41
- Thank you received: 9
-
-

13 years 4 days ago -  13 years 2 days ago [\#133871](#133871) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  Replied by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")* on topic *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#133871 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")*

Nicolas, thanks for Your advice, but I have tried ALL possible setting combinations, and this still happens. Could You be so kind and check this out - I presume that I'm not the only one with this problem. Please see man current configuration below:

[ ![ha50813e.jpg](/forum/attachment/13965) ](/forum/attachment/13965 "ha50813e.jpg")

Up to this moment I simply rewrote attachinvoice.php, but it's not the solution, as You can understand - it's just a temporary fix becaus all the data stored in hikashop backend is still incorrect.

- [ ![ha50813e.jpg](/forum/attachment/13965) ](/forum/attachment/13965 "ha50813e.jpg") [ ](/forum/attachment/13965?download=1 "ha50813e.jpg")

Last edit: 13 years 2 days ago by [Savickis](/forum/user/26490-savickis "View Savickis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Savickis](/forum/user/26490-savickis "View Savickis's Profile")**
- [![Savickis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26490.jpg)](/forum/user/26490-savickis "View Savickis's Profile") Topic Author
- [ Offline](/forum/user/26490-savickis)

Less More

- Posts: 41
- Thank you received: 9
-
-

13 years 3 days ago -  13 years 2 days ago [\#134058](#134058) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  Replied by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")* on topic *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#134058 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")*

Just to be sure - what I need is that "TOTAL" for order would be as follows:

**TOTAL = (Total without tax - Discount) + ((Total without tax - Discount)\*tax)**

so as in example in the first post -

**18.69 = (16.45 - 1.00) + ((16.45 - 1.00) \* 0.21)**

Could You please tell me, where the Total calculation logic is stored to make it work like in my example above?

Last edit: 13 years 2 days ago by [Savickis](/forum/user/26490-savickis "View Savickis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Savickis](/forum/user/26490-savickis "View Savickis's Profile")**
- [![Savickis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26490.jpg)](/forum/user/26490-savickis "View Savickis's Profile") Topic Author
- [ Offline](/forum/user/26490-savickis)

Less More

- Posts: 41
- Thank you received: 9
-
-

13 years 1 day ago -  13 years 1 day ago [\#134209](#134209) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  Replied by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")* on topic *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#134209 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")*

Any ideas? I presume it's really small change in existing calculation continuity, so could Nicolas point the file to start digging?

Temporary workaround that I'm using right now:

Through "Hikashop settings &gt; Display &gt; Views" option I edited "Checkout &gt; Cart" template.
Replaced line Code:

echo $this-&gt;currencyHelper-&gt;format($this-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax,$this-&gt;full_total-&gt;prices[0]-&gt;price_currency_id);

with Code:

$pricevar = $this-&gt;currencyHelper-&gt;format($this-&gt;full_total-&gt;prices[0]-&gt;price_value); $price= str_replace(',','.',$pricevar); $taxvar = $this-&gt;currencyHelper-&gt;format($tax-&gt;tax_amount); $tax= str_replace(',','.',$taxvar); $total = $price + $tax; $result = round($total, 2); echo '' .$result. ' EUR';

And the same in "siteroot\plugins\hikashop\attachinvoice\attachinvoice\attachinvoice.php"

But as I mentioned before - order totals in system doesn't match up, so this is just a temporary fix! Please reply to question stated above - how to change existing calculation continuity?

Last edit: 13 years 1 day ago by [Savickis](/forum/user/26490-savickis "View Savickis's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Savickis](/forum/user/26490-savickis "View Savickis's Profile")**
- [![Savickis's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar26490.jpg)](/forum/user/26490-savickis "View Savickis's Profile") Topic Author
- [ Offline](/forum/user/26490-savickis)

Less More

- Posts: 41
- Thank you received: 9
-
-

12 years 11 months ago [\#134853](#134853) by [Savickis](/forum/user/26490-savickis "View Savickis's Profile")  Replied by *[Savickis](/forum/user/26490-savickis "View Savickis's Profile")* on topic *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#134853 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")*

Any updates?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Tristan](/forum/user/30080-tristan "View Tristan's Profile")**
- [![Tristan's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar30080.png)](/forum/user/30080-tristan "View Tristan's Profile")
- [ Offline](/forum/user/30080-tristan)

Less More

- Posts: 73
- Thank you received: 7
-
-

12 years 9 months ago [\#143923](#143923) by [Tristan](/forum/user/30080-tristan "View Tristan's Profile")  Replied by *[Tristan](/forum/user/30080-tristan "View Tristan's Profile")* on topic *[Apply discounts before taxes doesnt work correctly](/forum/27-checkout/863346-apply-discounts-before-taxes-doesnt-work-correctly#143923 "-- url of the page with the problem -- : http://pastastacija&#91;dot&#93;lv/lv/ieg%C4%81d%C4%81ties-kodu -- HikaShop version -- : HikaShop Business 2.2.2 -- Joomla version -- : 2.5.14 -- PHP version -- : 5.24  Hello! Our accountant pointed out that there is slight error in the way how hikashop applys bulk-order discounts. Problem, as it seems, is that option &quot;Apply discounts After/Before taxes&quot; doesn't work as it should. Please see attached order invoice as it's generated now:  You can see this in action by visiting link above, placing any of the products in cart, and then changing quantity to 10 - it will apply 5% discount, and You can instantly see this miscalculation in cart table.  Of course, I could just edit attachinvoice/invoice.php to correct invoices, but than price totals in Hikashop backend won't mach the ones in invoices sent to clients, so I'd like to undertstand what's wrong with current calculation logic...  Thanks for helping sort this out in advance. Best regards, Arthur .")*

Hi,

We updated Hikashop recently, and made some changes on discounts applied before / after tax. Download the very latest version on our website, and install it (without changes you made). You shouldn't have any problem with those discounts anymore.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzM0Ni1hcHBseS1kaXNjb3VudHMtYmVmb3JlLXRheGVzLWRvZXNudC13b3JrLWNvcnJlY3RseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.071 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
