Jump to content

Rounded price is displayed but unrounded price is used for calculations


Jacek Es

Recommended Posts

Hi,

I have discovered this on PrestaShop 8.1.7. It applies to rounding methods: Round on each line and Round on total when currency Decimals is set to 2. PrestaShop 8.1 rounds Unit Price with discount applied value but uses unrounded value for further calculations. This makes the calculations appear wrong.

Example:
Product base price: £0.30
Discount from 1000pcs: 31%
Product price with discount applied: £0.207 (rounded to £0.21)

PrestaShop makes the following calculations:
image.png.f378e41729f5b117002ff113d1a88246.png

£0.21 * 1000 cannot be £207.00

The problem is that rounded Unit Price with discount is displayed (£0.21) but unrounded value is taken to the calculations (£0.207).

 

Possible approaches to correct this:

1. Display rounded value and use it for further calculations (as it was in PrestaShop 1.6):

£0.21 * 1000 = £210.00

2. Display unrounded value and use it for further calculations (but the shop is set to 2 Decimals which is an issue):

£0.207 * 1000 = £207.00

How to fix this?

Thanks

 

 

 

Link to comment
Share on other sites

There would be a sense to it - to have calculations on the invoice and during checkout process that are mathematically correct. You cannot have the following:

£0.21 * 1000 = £207.00

You can either have:

£0.21 * 1000 = £210.00
or
£0.207 * 1000 = £207.00

Don't you agree?

 

In PrestaShop 1.6 with Classical rounding mode the calculations were made correct - the rounded value was displayed and used for the calculations:
image.png.fcfcd2f798a6575ad73add2a6f80d79c.png

 

Link to comment
Share on other sites

  • 4 weeks later...
  On 10/31/2024 at 1:37 PM, Nickz said:

if you like the way Prestashop 1.6 handled the issue, then use 1.6.

Expand  

What a stupid response!
Objectively, the new rounding system in PrestaShop 8.x has several flaws.
Many times, when I set a tax-inclusive price, for example, "8€", PrestaShop saves it as "8.0000001". This is likely due to the double calculation (Tax-inclusive price --Calculate--> Tax-exclusive price --Recalculate--> Tax-inclusive price). And while this may seem like a minor issue, it often causes confusion and poor impressions for customers making purchases. I’ve tried solving it in various ways, but the problem persists (especially during invoice generation). Similar issues, of course, are also present with specific prices.

Now... we can either calmly acknowledge the issue and try to address it (at the core level), or we can blindly respond to such concerns with a curt: "use version 1.6 if you like it so much." But this approach will only push professionals to adopt other e-commerce platforms.

Link to comment
Share on other sites

Thanks MadMar. I didn't want to comment on the previous reply no to heat up emotions but you are spot on it.

You are right... the new rounding system has flows and these aren't easy to fix. I have even hired a professional  PrestaShop developer. He initially quoted the task for 2-3 days work but is already on it for 3 weeks.

From the possible approaches that I suggested:

1. Display rounded value and use it for further calculations (as it was in PrestaShop 1.6):

£0.21 * 1000 = £210.00

2. Display unrounded value and use it for further calculations (but the shop is set to 2 Decimals which is an issue):

£0.207 * 1000 = £207.00

he has already abandoned the approach 1. above. He is now trying to implement the 2nd approach but it's a messy road.

 

Your suggestion seems to be the best - address the issue at the core level

Link to comment
Share on other sites

  • 3 months later...

Hello Jacek Es,

Did you manage to solve this problem?

I have the same issue. 

The order comes in with the correct item price (10.80), but when I generate the invoice sometimes the price on the order changes (10.81) but o the invoice is 10.80

I use an external billing program.

The Price is: 9.075630 VAT excl. and 10.80 VAT incl.

My rounding option are:

- Round up away from zero, when it is half way there.

- Round on each item

 

 

Link to comment
Share on other sites

  On 3/20/2025 at 3:22 PM, Jacek Es said:

No, sadly I haven't. It appears this issue is not straightforward to fix. Sadly no one from PrestaShop cares even to reply to this Bug report. The issue has been reported by others on other forums but still no solution.

Expand  

If you are all un happy with the Prestashop solution you could move. 
Prestashop is going the SaaS way You rent the shop and get what they offer. you wich for more you pay their prices..

 

Link to comment
Share on other sites

  On 3/20/2025 at 3:22 PM, Jacek Es said:

No, sadly I haven't. It appears this issue is not straightforward to fix. Sadly no one from PrestaShop cares even to reply to this Bug report. The issue has been reported by others on other forums but still no solution.

 

Expand  

Report on the GitHub. I don't think the Prestashop core team is checking the Forums. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...