Any way to render money metafields without rounding?

We use metafields of type money to display discounts on the storefront. This approach works well because the discount is automatically converted to the presentment currency.

However, the converted value is rounded according to the currency’s rounding rules. This creates an issue since our Shopify Function subtracts the discount from the total price, and the rounding on the storefront results in a mismatch.

Is there a way to display the unrounded, converted value of a money-type metafield in the presentment currency using Liquid?

For example:

  • Original Discount: 100 USD
  • Expected Converted Discount without Rounding: 95.65 EUR (based on current exchange rates)
  • Actual Output with Rounding: 95.95 EUR

Hey Anton,

Just trying to understand this issue a bit more - at what point exactly is the rounding happening? Are you looking to disable just the rounding when the metafield is being displayed but keep the rounding on the stores’ currently rules?

Hi Liam,

Thank you for your reply!

The rounding occurs when we render a money metafield in our app block using the code similar to this: {{ product.metafields.custom.discount.value | money }}.

What I’m looking to do is disable the rounding in this specific case while still keeping the conversion to the presentment currency. Since we store a fixed amount discount in this metafield, we just need to display it “as is” without any rounding applied.

Quick thought is that 0.65 EUR should never “round” to 0.95 EUR.

My guess is that the exchange rate is different? If anything it would round to the nearest whole right?

@RobDukarski I think EUR is rounded to 0.95. Below is the screenshot from the Markets settings with Price rounding enabled.

1 Like