News:

Looking for documentation? Take a look on our wiki

Main Menu

wrong price rounding

Started by jankoo, February 12, 2025, 12:43:49 PM

Previous topic - Next topic

jankoo

hi.
im builing new store on latest vm.
i have products with prices by quantity.
im also using tax per product +%

so i setup the price without tax, and trying to calculate price, that that selling price is rounded nice.. so i put price that have 2 decimals, for example 2,77. but the final price is not 2 decimals, but 4.. this make issues whe user is buying more pcs of the same product.. than than the final price is rounding wrong..

i setup the price decimals to 2 in vm settings..
im not sure if im missing something else, or this is normal.. or bug..
im sending my printscreens

thanks for any advices

iWim

How does it display on the frontend?
AFAIK these settings are for the frontend.

jankoo

hi.
on frontent the price is "shows" ok as 3,30..
but when i put more than one piece of the product in the cart, the accumulated price is going wrong.. as its somehow still calculate that 4 decimals and round only after that.. for example i have in cart price
164,82 for 50psc of this product.. im not sure if you understand what i mean.. is this normal behaviour?
how to prevent this? thank you

ViPeS

If you need to get Final price 3.30 then set Cost price equal to 3.30 : 1.19 = 2.773109, and set Rounding Digits to -1
VM 4.4.6 11109, Joomla 5.2.4, PHP 8.3.8

Ghost

You can disable "Round only display" to remove discrepancy between internal prices and display prices. But I think it's a bug that rounding accumulates between products with or without that option.

hazael

#5
If you have a very large number of products, you can do this in spreadsheets in minutes. Export all product prices without tax to a spreadsheet. In the spreadsheet, create a second column with a rule that calculates the price with tax and rounds these values according to your preferences. Then in the third column, based on the gross price, create new prices without tax with 5 decimal places and send these values to the database.