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

#   Wrong result on discount + coupon

##

- **[nico1979](/forum/user/31330-nico1979 "View nico1979's Profile")**
- [![nico1979's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/31330-nico1979 "View nico1979's Profile") Topic Author
- [ Offline](/forum/user/31330-nico1979)

Less More

- Posts: 78
- Thank you received: 6
-
-

3 years 8 months ago -  3 years 8 months ago [\#350005](#350005) by [nico1979](/forum/user/31330-nico1979 "View nico1979's Profile")  *[Wrong result on discount + coupon](/forum/46-discount-coupon/906057-wrong-result-on-discount-coupon#350005 "-- url of the page with the problem -- :   www.erboristeriazambrini.it/  -- HikaShop version -- : 4.7.1 -- Joomla version -- : 3.10.11 -- PHP version -- : 7.4 -- Browser(s) name and version -- : All  Hi, there is an error applying discount and coupon on the same product. Example: I've got a product 100€ This product has a discount 20% = 80€ Correct I've made a 30% coupon with the field Coupon handling of discounted products set as Override discounted products. The result isn't 70€ but 76€. Why? If I unpublish the discount the result is correct 70€ If I set the discount as 10% the result is 73€ It seems that the discount value is applied to the coupon value. 100 - &#91;(100 &#42; 30%) - 20%&#93; = 76 100 - &#91;(100 &#42; 30%) - 10%&#93; = 73  Thank you")* was created by *[nico1979](/forum/user/31330-nico1979 "View nico1979's Profile")*

-- url of the page with the problem -- : [ www.erboristeriazambrini.it/](https://www.erboristeriazambrini.it/)
-- HikaShop version -- : 4.7.1
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4
-- Browser(s) name and version -- : All

Hi,
there is an error applying discount and coupon on the same product.
Example:
I've got a product 100€
This product has a discount 20% = 80€ Correct
I've made a 30% coupon with the field Coupon handling of discounted products set as Override discounted products.
The result isn't 70€ but 76€. Why?
If I unpublish the discount the result is correct 70€
If I set the discount as 10% the result is 73€
It seems that the discount value is applied to the coupon value.
100 - [(100 * 30%) - 20%] = 76
100 - [(100 * 30%) - 10%] = 73

Thank you

Last edit: 3 years 8 months ago by [nico1979](/forum/user/31330-nico1979 "View nico1979's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDYwNTctd3JvbmctcmVzdWx0LW9uLWRpc2NvdW50LWNvdXBvbj90bXBsPW1hcmtkb3du) 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: 86556
- Thank you received: 14304
-
-

3 years 8 months ago [\#350009](#350009) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Wrong result on discount + coupon](/forum/46-discount-coupon/906057-wrong-result-on-discount-coupon#350009 "-- url of the page with the problem -- :   www.erboristeriazambrini.it/  -- HikaShop version -- : 4.7.1 -- Joomla version -- : 3.10.11 -- PHP version -- : 7.4 -- Browser(s) name and version -- : All  Hi, there is an error applying discount and coupon on the same product. Example: I've got a product 100€ This product has a discount 20% = 80€ Correct I've made a 30% coupon with the field Coupon handling of discounted products set as Override discounted products. The result isn't 70€ but 76€. Why? If I unpublish the discount the result is correct 70€ If I set the discount as 10% the result is 73€ It seems that the discount value is applied to the coupon value. 100 - &#91;(100 &#42; 30%) - 20%&#93; = 76 100 - &#91;(100 &#42; 30%) - 10%&#93; = 73  Thank you")*

Hi,

I think there is indeed an issue in that calculation mode.
Change the code: Code:

$coupon-&gt;discount_flat_amount += ($coupon-&gt;discount_percent_amount * $product-&gt;prices[0]-&gt;$price) / 100;

to: Code:

$coupon-&gt;discount_flat_amount += ($coupon-&gt;discount_percent_amount * $product-&gt;prices[0]-&gt;$price_without_discount) / 100;

(several places) in the file administrator/components/com_hikashop/classes/discount.php and it should calculate based on the initial price and not the discounted price.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi85MDYwNTctd3JvbmctcmVzdWx0LW9uLWRpc2NvdW50LWNvdXBvbj90bXBsPW1hcmtkb3du) 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.040 seconds

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