Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
Source Link

How can I support product prices which have a precision greater than the currency's minor unit in Drupal Commerce?

Any idea how to support prices which have more decimal places than a currency supports in Drupal Commerce?

Use case is that I'm trying to build a website which has some very small parts, whose unit price can have factions of cents ie a small bearing which has a unit price of $0.05742.

Typical users would order 1000s at a time and price is rounded to nearest cent at payment time.

But a commerce_price (in USD) only supports 'whole' cents (to reflect the minor unit format). Entering 0.05472 in the price field causes rounding to 0.05 and this rounded value is also the value written out to the db.

Any suggestions?

Thanks