Offer currency formatting fixes #25820
Draft
+67
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Got some code for us? Awesome 🎊!
Please take a minute to explain the change you're making:
Why are you making it?
This change addresses inconsistent currency formatting for offer prices and discounts across the Ghost frontend (Portal) and admin panel (Admin-X-Settings). Previously, currency values were sometimes missing trailing zeros, currency symbols, or were not formatted as proper currency amounts (e.g.,
$1.2instead of$1.20, or1.2 USDinstead of$1.20). The goal is to ensure consistent, proper currency formatting, where whole dollar amounts (e.g., $5) do not show trailing zeros, but amounts with cents (e.g., $1.20) do.What does it do?
This PR introduces a new
formatCurrencyhelper function in bothapps/portalandapps/admin-x-settings. This function intelligently formats currency amounts:$1.20,$1.50).$5,$10).All relevant offer-related UI components (offer checkout page, offer discount tags, offer list, offer overview cards) have been updated to utilize this new consistent formatting logic.
Why is this something Ghost users or developers need?
For Ghost users (members and admins): Provides a more professional and trustworthy experience by ensuring all offer-related currency displays are accurate, consistent, and easy to read, matching standard currency conventions.
For Ghost developers: Establishes a centralized and robust utility for currency formatting, reducing the likelihood of future inconsistencies and simplifying currency display logic.
Please check your PR against these items:
We appreciate your contribution! 🙏
Linear Issue: DES-1268