Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Discount Calculation if an Article is assigned to Coupon #936

Conversation

janspeller
Copy link

The Calculation of the Discount Value is not precise if:

  • Coupon has an Article assigned
  • Article Quantity is higher than 1
  • Article has odd price (like 1.62 used for the written Test)

The Coupon Value in the Basket will be rounded to 2 Decimals before being multiplied by the Article Quantity. This leads to an inprecise Calculation.

@Sieg
Copy link
Member

Sieg commented Aug 21, 2024

Hey @janspeller, is the test you added green for you?

@Sieg
Copy link
Member

Sieg commented Aug 21, 2024

@janspeller The issue here is how the shop calculates discounts based on your current currency precision settings. Let me explain.

For a general 10% coupon, it correctly deducts 10% (e.g., 1.62). But in your case, the discount is applied to each item individually.
This is important because the storage application might also show each item as 10% discounted, rounding the price for each item. This is where the precision issue arises.

If we apply the discount as you suggest, it would treat it as a general coupon, which could cause problems with the accounting and lead to mismatched totals.

I agree there’s an issue. We can't currently separate calculation and display settings to make your requested calculation work without affecting the final price display.

To move forward, please go to Master Settings -> Core Settings -> Settings -> Other Settings, find the Currency configuration, change the precision for EUR to 3 decimal places, and see how the discount is calculated.

@Sieg
Copy link
Member

Sieg commented Aug 21, 2024

Closing this topic for now, as we cannot take the PR as you suggested, but there is a plan to improve this part in the future, so it will be more configurable. Anyway, thank you for your interest and trying to improve this!

@Sieg Sieg closed this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants