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

#   Rounding errors in order/cart totals?

##

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

Less More

- Posts: 43
- Thank you received: 0
-
-
-
- [](http://www.sloansweb.com)
-

13 years 4 months ago -  13 years 4 months ago [\#111844](#111844) by [sloanthrasher](/forum/user/1156-sloanthrasher "View sloanthrasher's Profile")  *[Rounding errors in order/cart totals?](/forum/4-how-to/84477-rounding-errors-in-order-cart-totals#111844 "Hi,  I have products which are priced in fractions of a cent (USD). The site sells mostly bulk quantities of the products.  The problem is that sometimes a line item will multiply (quantity &#42; price each) to a number with a fractional cent. For example: 50 &#42; 0.3245 = 16.225, displayed as 16.23, or 100 &#42; 0.34224 = 34.234, displayed as 34.23. If there are several items like this in the cart, the total is sometimes off a cent or two.  Where in the code will I find the code that calculates the total for the cart, and for the order?  Thanks!  Sloan")* was created by *[sloanthrasher](/forum/user/1156-sloanthrasher "View sloanthrasher's Profile")*

Hi,

I have products which are priced in fractions of a cent (USD). The site sells mostly bulk quantities of the products.

The problem is that sometimes a line item will multiply (quantity * price each) to a number with a fractional cent. For example: 50 * 0.3245 = 16.225, displayed as 16.23, or 100 * 0.34224 = 34.234, displayed as 34.23. If there are several items like this in the cart, the total is sometimes off a cent or two.

Where in the code will I find the code that calculates the total for the cart, and for the order?

Thanks!

Sloan

---

Sloan Thrasher

Last edit: 13 years 4 months ago by [sloanthrasher](/forum/user/1156-sloanthrasher "View sloanthrasher's Profile"). Reason: mis-spelled word

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0NDc3LXJvdW5kaW5nLWVycm9ycy1pbi1vcmRlci1jYXJ0LXRvdGFscz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Eliot](/forum/user/1824-eliot "View Eliot's Profile")**
- [![Eliot's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar1824.png)](/forum/user/1824-eliot "View Eliot's Profile")
- [ Offline](/forum/user/1824-eliot)

Less More

- Posts: 2334
- Thank you received: 403
-
-

13 years 4 months ago [\#111878](#111878) by [Eliot](/forum/user/1824-eliot "View Eliot's Profile")  Replied by *[Eliot](/forum/user/1824-eliot "View Eliot's Profile")* on topic *[Rounding errors in order/cart totals?](/forum/4-how-to/84477-rounding-errors-in-order-cart-totals#111878 "Hi,  I have products which are priced in fractions of a cent (USD). The site sells mostly bulk quantities of the products.  The problem is that sometimes a line item will multiply (quantity &#42; price each) to a number with a fractional cent. For example: 50 &#42; 0.3245 = 16.225, displayed as 16.23, or 100 &#42; 0.34224 = 34.234, displayed as 34.23. If there are several items like this in the cart, the total is sometimes off a cent or two.  Where in the code will I find the code that calculates the total for the cart, and for the order?  Thanks!  Sloan")*

Hi Sloan,

Actually, Hikashop Was doing that kind of rounding before but people were complaining because total wasn't exact.
What the hikashop system is doing now is calculate the perfect result for each product (rounded on display but not in our calculation) and calculate the exact total of the order.
It means that when we calculate the total of your orders, we use the exacts price of your product and make a rounding only on the very final price.
So the price displayed is the right one.

However, if you really want to make some round, you can take a look at the function quantityPrices in currency.php in administrator/components/com_hikashop/classes

The following user(s) said Thank You: [sloanthrasher](/forum/user/1156-sloanthrasher "View sloanthrasher's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0NDc3LXJvdW5kaW5nLWVycm9ycy1pbi1vcmRlci1jYXJ0LXRvdGFscz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

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

Less More

- Posts: 43
- Thank you received: 0
-
-
-
- [](http://www.sloansweb.com)
-

13 years 4 months ago [\#111886](#111886) by [sloanthrasher](/forum/user/1156-sloanthrasher "View sloanthrasher's Profile")  Replied by *[sloanthrasher](/forum/user/1156-sloanthrasher "View sloanthrasher's Profile")* on topic *[Rounding errors in order/cart totals?](/forum/4-how-to/84477-rounding-errors-in-order-cart-totals#111886 "Hi,  I have products which are priced in fractions of a cent (USD). The site sells mostly bulk quantities of the products.  The problem is that sometimes a line item will multiply (quantity &#42; price each) to a number with a fractional cent. For example: 50 &#42; 0.3245 = 16.225, displayed as 16.23, or 100 &#42; 0.34224 = 34.234, displayed as 34.23. If there are several items like this in the cart, the total is sometimes off a cent or two.  Where in the code will I find the code that calculates the total for the cart, and for the order?  Thanks!  Sloan")*

Thanks Eliot.

I made the changes in quantityPrice, not quantityPrices, since that's where the quantity and price were multiplied. Is that correct?

Thanks!

---

Sloan Thrasher

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0NDc3LXJvdW5kaW5nLWVycm9ycy1pbi1vcmRlci1jYXJ0LXRvdGFscz90bXBsPW1hcmtkb3du) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

13 years 4 months ago [\#111888](#111888) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Rounding errors in order/cart totals?](/forum/4-how-to/84477-rounding-errors-in-order-cart-totals#111888 "Hi,  I have products which are priced in fractions of a cent (USD). The site sells mostly bulk quantities of the products.  The problem is that sometimes a line item will multiply (quantity &#42; price each) to a number with a fractional cent. For example: 50 &#42; 0.3245 = 16.225, displayed as 16.23, or 100 &#42; 0.34224 = 34.234, displayed as 34.23. If there are several items like this in the cart, the total is sometimes off a cent or two.  Where in the code will I find the code that calculates the total for the cart, and for the order?  Thanks!  Sloan")*

yes.

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

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