webdna / commerce-bulk-pricing

Other
2 stars 2 forks source link

Changing the price to 3 decimal places #9

Closed terryupton closed 2 years ago

terryupton commented 2 years ago

Hi.

is it possible to set the pricing to 3 decimal places? My client has several products that are priced like so: 1 @ 22.25 2 @ 19.75 4 @ 19.125

However, the @ 4 pricing is being rounded to £19.13 and thus the final price is £76.52 instead of £76.50 I know we are only talking pennies here, but they have mentioned it as they have a pricing structure and I am not sure how far this impacts them.

mcjackson18 commented 2 years ago

Hi @terryupton, the number of decimal places used a line item is actually set by Craft Commerce. The bulk pricing plugin uses the 3 decimal place value but when saved on the line time the price is rounded - https://github.com/craftcms/commerce/blob/develop/src/models/LineItem.php#L392