Hi everyone,
We are developing a B2B application using the Cart Transform Function to implement a complex pricing model that includes legally mandated duties. We are struggling to maintain the required precision for unit prices, which results in minor but legally problematic discrepancies in the final cart total.
Our pricing requires adding legal duties, which are calculated with 5 decimal places of precision, to the base product price.
The core problem is that Shopify rounds the unit_price output from the function to 2 decimal places before multiplying it by the quantity, leading to legally incorrect totals.
Example Scenario:
-
Correct Unit Price: $13.56386 ($10.00 base + $3.56386 duty).
-
Quantity: 10 items.
-
Expected Total (Rounded Final Total): $13.56386 * 10 = $135.64.
-
Actual Shopify Result (Rounding Unit Price First): Shopify rounds the unit price to $13.56$. Then $13.56 * 10 = $135.60.
This $0.04 difference is a legal compliance issue for us.
Is there any way to bypass this 2-decimal rounding limitation for the unit_price in the Cart Transform Function, or an alternative method to apply high-precision adjustments to the cart?
Thanks for any help!