Cart Transform Function: Preserving >2 Decimal Unit Price for Duty/Tax Calculations

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:

  1. Correct Unit Price: $13.56386 ($10.00 base + $3.56386 duty).

  2. Quantity: 10 items.

  3. Expected Total (Rounded Final Total): $13.56386 * 10 = $135.64.

  4. 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!

Hey @aurelien_galadrim thanks for flagging this. This is a current limitation on our end, just wanted to confirm that with you after we reviewed some code. That said, I definitely understand that this isn’t ideal (especially given the legal compliance requirement). I’ve set up an official feature request for you on our end for this, just so that we have your report logged. I can’t guarantee a turnaround time/an implementation of this, but I did want to thank you for your report and let you know we are aware of this behaviour.

Let me know if I can clarify anything on my end here or if I can add anything to the feature request report I have logged, happy to help where I can.