Discount Function: fixedAmount loses precision with multi-currency conversion

Summary

When using a Shopify discount function with fixedAmount, the discount amount loses precision when the presentment currency differs from the shop’s base currency. Shopify appears to convert the discount to base currency, round/floor it, then convert back — causing the applied discount to differ from the requested amount.

We started noticing this behavior around January 23, 2025.

This issue is related to my previous post about Inconsistent cents rounding on discounts across different stores, but affects a different scenario: multi-currency stores using fixedAmount discounts.

Expected Behavior

When I return a fixedAmount discount of 0.70 SEK, I expect Shopify to apply a 0.70 SEK discount.

Actual Behavior

Shopify applies 0.65 SEK instead of 0.70 SEK.

Evidence

Function input:

{
  "presentmentCurrencyRate": "10.769874",
  "cart": {
    "lines": [{
      "cost": { "subtotalAmount": { "amount": "128.7" } }
    }]
  }
}

Function output:

{
  "value": {
    "fixedAmount": {
      "amount": "0.7",
      "appliesToEachItem": false
    }
  }
}

Checkout result:

Expected Actual
Discount 0.70 SEK 0.65 SEK
Final price 128.00 SEK 128.05 SEK

Analysis

It appears Shopify is doing:

  1. Convert discount to base currency: 0.70 / 10.769874 = 0.065 EUR
  2. Round/floor to 2 decimals: 0.06 EUR
  3. Convert back: 0.06 × 10.769874 = 0.65 SEK

This causes precision loss, making it impossible to apply exact discount amounts in presentment currencies with high conversion rates.

Questions

  1. Is this the intended behavior for fixedAmount discounts?
  2. Should the amount field be specified in base currency or presentment currency?
  3. Is there a way to apply precise discount amounts in presentment currencies?
  4. Is this related to the changes that caused the inconsistent rounding behavior reported in my previous post?

Environment

  • Discount Function API version: 2024-10
  • Using productDiscountsAdd with fixedAmount
  • Base currency: EUR
  • Affected presentment currency: SEK (and likely others with high conversion rates)

Hi @dostu, thanks for reaching out about this!

I have a few questions before I start digging into this:

  • Is this issue happening with normal discounts as well or just discounts based on Functions?
  • Are you seeing this across multiple shops or some?
  • What does the currency settings look like for the affected markets? e.g.

Thanks for the quick reply!

  1. For normal discounts it’s only allowed to set up the discount in base currency, so it doesn’t affect them.

  1. Yes, this seems to be the default behaviour for all stores now.

  2. No rounding is set up on Market level.

Thanks for sharing!
I’ll look into whether there has been any changes on our end recently and get back to you.

3 Likes

I would be really grateful if you could nudge someone to look at @dostu’s original post: Inconsistent Cents Rounding on Discounts Across Different Stores - #2 by bkspace

It’s been 11 days with no communication.

3 Likes

@Paige-Shopify any updates on this please? :folded_hands:

Hi @dostu, apologies for the delay.
We needed to spend some time investigating this issue and are currently working on a fix. Your detailed report was incredibly helpful, thank you! I’ll provide an update here once the fix has been deployed.

1 Like