Page 1 of 1
Remove Decimals From Prices
Posted: Mon Dec 18, 2017 9:15 am
by aghafarokh
Hi
i'm using 2.3.0.2
all of my products prices are round
and now i want to remove the 00 decimals that showing on my every products price
please guide me
Re: Remove Decimals From Prices
Posted: Mon Dec 18, 2017 7:23 pm
by sachin6609
aghafarokh wrote: ↑Mon Dec 18, 2017 9:15 am
Hi
i'm using 2.3.0.2
all of my products prices are round
and now i want to remove the 00 decimals that showing on my every products price
please guide me
Use The php number formate function
https://www.w3schools.com/php/func_stri ... format.asp
Thanks
Re: Remove Decimals From Prices
Posted: Mon Dec 18, 2017 8:39 pm
by paulfeakins
Re: Remove Decimals From Prices
Posted: Mon Dec 18, 2017 10:02 pm
by aghafarokh
Re: Remove Decimals From Prices
Posted: Mon Dec 18, 2017 10:11 pm
by aghafarokh
i'm really tired
i've search all of this forum and try everything
it's not working
when i edit one product and remove the decimal (.00000) from its product and save it
when i refresh the page for the first time all product prices are good without decimal BUT when i refresh it again
those price decimals (.000000) coming baaaacccccckkkkkks
Re: Remove Decimals From Prices
Posted: Tue Dec 19, 2017 2:32 pm
by sachin6609
aghafarokh wrote: ↑Mon Dec 18, 2017 10:11 pm
i'm really tired
i've search all of this forum and try everything
it's not working
when i edit one product and remove the decimal (.00000) from its product and save it
when i refresh the page for the first time all product prices are good without decimal BUT when i refresh it again
those price decimals (.000000) coming baaaacccccckkkkkks
which opencart vserion you are using let me know also the site url please
on which page you want to do this
so i can help you
Thanks
Sachin
Re: Remove Decimals From Prices
Posted: Wed Dec 20, 2017 3:08 am
by rgbrewer
The database itself is designed to hold a number with four decimal places, and if you give it a whole number like 123, the database still stores 123.0000
The OC code then grabs that 123.0000 number and formats it to the appropriate human-readable currency via the currency library in the system folder... so 123.000 becomes $123.00
You could edit your currency library such that it only returns the numbers before the decimal place.
This is a very simple change for an OC developer, and I'd be surprised if there werent any mods that already do it for you.
Re: Remove Decimals From Prices
Posted: Tue Jun 02, 2020 10:57 pm
by Leutzu
Settings -> Localisation -> Currencies. Locate the currency of your store (ex. USD) and click the Edit button on the righ (pencil symbol). Under decimal places you probably have 2. Change it 0 then Save. Check a product page in your browser (refresh the browser if you already had it open). It should show the price without the decimals.