Rounding Up

  • Posts: 12
  • Thank you received: 0
3 months 1 day ago #361420

-- HikaShop version -- : 5.0.4
-- Joomla version -- : 5.1.1
-- PHP version -- : 8.1.28

Hi

I have an issue with rounding up. I have a product that should show as £19.95 GBP (including tax).
I have the product as £16.62500 without tax that is showing as £19.95 with tax in the back end however the front end is showing as £19.96.
If I change the price without tax to £16.62499 it shows front end as £19.94.
If I remove the without tax price and enter the value of 19.95 in the with tax box, it automatically sets the without tax price to 16.62500 but still shows front end as £19.96.
I am using the PayPal Checkout plugin and have rounding enabled as without this, PayPal was throwing up MISMATCH errors and customers were having issues completing payments.

In Currencies, GBP shows as the rate of 1.000000 (six decimal places) and I have tried changing this to five and also two but when I save, it says the save is successful but does not apply the changes. Plugin seems to show price as 0.00000 GBP (only five decimal places) so I'm wondering if this difference is causing the problem?

We only use GBP so do we really need to use five decimal places?

Any help would be most appreciated. Thank you

Last edit: 3 months 1 day ago by askjim.

Please Log in or Create an account to join the conversation.

  • Posts: 82308
  • Thank you received: 13257
  • MODERATOR
3 months 1 day ago #361428

Hi,

If you need more decimals for the price without tax, in order to get the price with tax to be spot on, you can go in your PHPMyAdmin, open the structure of the hikashop_price table, and edit the column "price_value" and increase the number of decimals.
You can see some screenshots with information about decimals on columns in PHPMyAdmin here:
www.tutorialspoint.com/how-to-specify-de...ase-using-phpmyadmin

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
3 months 1 day ago #361431

Thank you for the reply Nicolas

Why do I need to increase the decimal places to 6?
Is this because the back end is showing 6 places in the Currency GBP but products and/or plugin is only showing with 5?

Using your method, would it work ok if I changed the decimal places to just 2?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
2 months 3 weeks ago #361488

I think there may be a bug in the system as changing those values made no difference.

When rounding is switched off, prices display correctly.
When switched on, if I add a price with tax, it automatically calculates the price without tax.
When I save, the price I entered (with tax) is now incorrect.

Surely whatever price I enter with tax and save should be the price I should see front and back end after the save, not a different price?

I tried changed the values in the price_value part of the database so it only used two decimal places. This then showed only two decimal places in the without tax price box however the price with tax was showing with three decimal places?

Please Log in or Create an account to join the conversation.

  • Posts: 82308
  • Thank you received: 13257
  • MODERATOR
2 months 3 weeks ago #361532

Hi,

So the problem is that with the "Round prices during calculations" setting activated, HikaShop will round the price without taxes before the calculations are done.
So if you have a price without taxes at 16.625, HikaShop will round the price to 16.63 before calculating the taxes and summing up both to get 19.96
I understand why you don't want that. In that case you would have to turn off this "Round prices during calculations" setting. We made it especially for this.
However, if you do that, then you can potentially get MISMATCH errors with PayPal. That's because PayPal only accept 2 decimals and it calculates itself the prices and check that the total it calculates corresponds to the total the PayPal plugin provides.
To avoid that, the only option is to turn on the "Round prices during calculations" setting setting so that HikaShop will make the calculations like PayPal, basing itself on prices with 2 decimals.
But in that case, you won't be able to get 19.95 in your example.
I'm afraid I don't have a quick solution here. The solutions I can think of would be:
- For PayPal to not recalculate the total and just take into account the total amount provided by the PayPal plugin
- For PayPal to allow for more decimals for the items in the order so that the PayPal plugin could provide more accurate prices which would allow it to reach the same total as what HikaShop can calculate with the "Round prices during calculations" setting turned off.
- To add an extra setting to the PayPal plugin to be able to not send the details of the order, just the total amount. That way, there is no calculation needed on PayPal's end. We'll look into adding this for the next version of HikaShop.

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
2 months 3 weeks ago #361533

Thanks for the reply.
So do we need to wait for the next version of Hikashop or the next version of the PayPal plugin?
What is the likely timescale before the appropriate one to fix this problem is released?
Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82308
  • Thank you received: 13257
  • MODERATOR
2 months 3 weeks ago #361535

Hi,

The PayPal Checkout plugin is included in HikaShop. So the next version of HikaShop will include the next version of the PayPal Checkout plugin.
It should be out in the next few days.

Please Log in or Create an account to join the conversation.

  • Posts: 12
  • Thank you received: 0
2 months 3 weeks ago #361549

Hi
I see the new version is now available.
Will this now fix the issues with the rounding of prices?
Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 82308
  • Thank you received: 13257
  • MODERATOR
2 months 3 weeks ago #361559

Hi,

The "send order details" setting has been added to the PayPal Checkout plugin with the new version. So if you turn off that setting in your PayPal Checkout payment method after updating your HikaShop, you should then be able to keep the "round prices during calculations" setting turned off while avoid the AMOUNT_MISMATCH error.

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum