Last updated

Product change - Changes to the saved precision of price fields

Last changed: 2022-03-24

An internal change to Norce [Storm] functionality that might change some presentation of price information.

Background

More and more solutions with Norce [Storm] works in many markets and with many different market prices. To be better prepared for more multi-currency and multi-market solutions, we are changing the precision on all price related fields to store 4 decimals instead of 2.

This lessens the risk of rounding errors when presenting the sale price including VAT to a storefront as well as for price calculations, where prices are adjusted to new currencies using Norce's exchange rates.

Changes

Price related fields are changed to save 4 decimals, these are:

  • SalePrice
  • CostPurchase
  • CostUnit
  • PriceRecommended
  • PriceStandard
  • PriceCatalog
  • PricePrevious

Consequences

In Storm API prices are already presented with 4 digits, although until now only two would have been used. What this change will do is that sometimes up to 4 decimals will be used (even if the currency does not support it), so it is highly suggested that the presentation of excluded VAT prices do its own rounding to two decimals in those cases.

When presenting prices including VAT the rounding rules set up in Norce [Storm] should already make the prices correctly rounded and no additional changes needs to be done.

When presenting Price ex vat, make sure to round the value to a valid number of decimals for the currency

Example

The product has a nice rounding rule to 9.99 EUR and the VAT is 19%

Before the precision change, Norce would save the price excluding VAT rounded to 2 decimals, which is: 8.40 (because 9.99 / 1.19 = 8.394957...)

And the price, when displayed in the frontend (including VAT) becomes: 10,00 (because 8.40 * 1.19 = 9.996 and is rounded up to 10)

But after the precision change, Norce saves 8.3950 instead (because 8.394957... is rounded to 4 decimals)

And the price, when displayed in the frontend is calculated correctly to 9.99 (because 8.3950*1.19 = 9.99005)