Skip to content

PRC-4676: Add zero fraction currencies#3950

Open
nima-ct wants to merge 7 commits intomainfrom
PRC-4676-add-zero-fraction-currencies
Open

PRC-4676: Add zero fraction currencies#3950
nima-ct wants to merge 7 commits intomainfrom
PRC-4676-add-zero-fraction-currencies

Conversation

@nima-ct
Copy link
Contributor

@nima-ct nima-ct commented Feb 27, 2026

Summary

In Application Discounts, we want to support both versions of the same currency with different fraction digits.

For more context:
https://commercetools.atlassian.net/wiki/spaces/MCF/pages/3016556878/Handling+Non-ISO+Currency+Variants
https://commercetools.atlassian.net/wiki/spaces/PAD/pages/2992570378/FO+Lower+Precision+Digits+Frontend+Impact+Proposed+Solution

This PR first updates the generated currency locale data to include fractionDigits (decimal precision) for each currency. It then creates explicit zero-fraction-digit currency code variants for a selected list of base currencies:
CZK → CZK0
HUF → HUF0
TWD → TWD0
TRY → TRY0
ILS → ILS0
KZT → KZT0

Locale-specific files have been regenerated using pnpm run generate-data

https://commercetools.atlassian.net/browse/FEC-354

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mc-app-kit-playground Ready Ready Preview, Comment Mar 13, 2026 11:53am
merchant-center-application-kit-components-playground Ready Ready Preview, Comment Mar 13, 2026 11:53am

Request Review

@nima-ct nima-ct self-assigned this Feb 27, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 27, 2026

🦋 Changeset detected

Latest commit: 2397c27

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@commercetools-frontend/l10n Minor
@commercetools-frontend/application-components Minor
@commercetools-frontend/application-shell Minor
@commercetools-applications/merchant-center-template-starter-typescript Minor
@commercetools-applications/merchant-center-template-starter Minor
@commercetools-applications/merchant-center-custom-view-template-starter-typescript Minor
@commercetools-applications/merchant-center-custom-view-template-starter Minor
@commercetools-local/playground Minor
@commercetools-website/components-playground Minor
@commercetools-frontend/codemod Minor
@commercetools-frontend/mc-scripts Minor
@commercetools-frontend/react-notifications Minor
@commercetools-local/visual-testing-app Minor
@commercetools-frontend/cypress Minor
@commercetools-backend/eslint-config-node Minor
@commercetools-backend/express Minor
@commercetools-backend/loggers Minor
@commercetools-frontend/actions-global Minor
@commercetools-frontend/application-config Minor
@commercetools-frontend/application-shell-connectors Minor
@commercetools-frontend/assets Minor
@commercetools-frontend/babel-preset-mc-app Minor
@commercetools-frontend/browser-history Minor
@commercetools-frontend/constants Minor
@commercetools-frontend/create-mc-app Minor
@commercetools-frontend/eslint-config-mc-app Minor
@commercetools-frontend/i18n Minor
@commercetools-frontend/jest-preset-mc-app Minor
@commercetools-frontend/jest-stylelint-runner Minor
@commercetools-frontend/mc-dev-authentication Minor
@commercetools-frontend/mc-html-template Minor
@commercetools-frontend/notifications Minor
@commercetools-frontend/permissions Minor
@commercetools-frontend/sdk Minor
@commercetools-frontend/sentry Minor
@commercetools-frontend/url-utils Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.91%. Comparing base (04429d8) to head (2397c27).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3950      +/-   ##
==========================================
- Coverage   71.95%   71.91%   -0.05%     
==========================================
  Files         263      263              
  Lines        6797     6801       +4     
  Branches     2075     2101      +26     
==========================================
  Hits         4891     4891              
- Misses       1885     1889       +4     
  Partials       21       21              
Components Coverage Δ
Application Components 81.18% <ø> (ø)
Application Shell 74.54% <ø> (ø)
Application Shell Connectors 77.54% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04429d8...2397c27. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@ByronDWall ByronDWall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that adding the fractionDigits value to the currency data is reasonable. I'm really wary of adding non-ISO-4217 currency codes to the currencies localization data though.

The following two objects describe amounts in the same currency, and so should use the same currency code.

  {
    "currencyCode": "HUF",
    "centAmount": 1235,
    "fractionDigits": 0
  },
  {
    "currencyCode": "HUF",
    "centAmount": 123500,
    "fractionDigits": 2
  } 

Fraction digits is metadata for that currency, and should not modify the currency code itself.

};

// Mapping of currencies that have a 0-fraction-digit variant (same label/symbol, fractionDigits 0).
export const ZERO_FRACTION_DIGITS_CURRENCY_MAPPING = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that we are introducing currency codes into our base currency data that are not ISO 4217 currency codes.

As an example, application-project-settings has a currency selector for all project currencies. The methods that map the currency values would return HUF and HUF0 in the dropdown, but would not have any other way for the user to differentiate between the two.

Moreover, any code that passes these currency codes to Intl.NumberFormat, commercetools APIs, payment providers, or any ISO 4217-aware system will fail or behave unexpectedly with HUF0.

The fundamental tension is: this PR is encoding a display/formatting preference (fraction digits) into the currency code itself, but currency codes are meant to identify currencies, not formatting rules.

@nima-ct could you perhaps give a little more context about what your team is trying to achieve here? I think that allowing multiple fraction digits for these currencies makes sense, but it seems to me like it should be handled separately from the currency code itself. Perhaps a project-level setting or formatting option?

};

// Per-locale suffix for zero-fraction currency label
const ZERO_DECIMAL_LABEL_SUFFIX_BY_LOCALE = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional context has been added for awareness

@nima-ct nima-ct requested a review from ByronDWall March 13, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants