fix(paywalls): use displayed price currency token for product.offer_price#7270
Draft
vegaro wants to merge 2 commits into
Draft
fix(paywalls): use displayed price currency token for product.offer_price#7270vegaro wants to merge 2 commits into
vegaro wants to merge 2 commits into
Conversation
…rice `product.offer_price` reformatted the discount's decimal price through `NumberFormatter`, which can emit a different currency token than the product's displayed price (e.g. "6,99 USD" instead of "$6.99") when the formatter locale metadata doesn't match the product currency. This made the offer price inconsistent with `product.price` and `product.currency_symbol`, both of which derive from the displayed price string. Format the discount's `localizedPriceString` instead, mirroring the base price path, so the currency token stays consistent across the paywall. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
{{ product.offer_price }}in Paywalls V2 reformatted the discount's decimal price through the product'sNumberFormatter. When the formatter's locale metadata doesn't match the product currency, that formatter emits a different currency token than the product's displayed price — e.g. rendering6,99 USDwhere the rest of the paywall shows$6.99. This is the same divergence that #6209 and #6572 fixed forproduct.currency_symbol, which now derives its token from the displayed price string.The offer price now formats the discount's
localizedPriceStringinstead, mirroring the baseproduct.pricepath, so the currency token stays consistent across the paywall.Known limitation: the per-period offer variables (
offer_price_per_day/week/month/year) still format viaNumberFormatterbecause the discount exposes no pre-formatted per-period display string to reuse. Left out of scope here.Testing
Added a regression test with a product whose displayed price uses
$but whose formatter locale (ro_RO) renders the currency differently; the offer price now matches the displayed token. Verified via the existing pay-up-front and zero-decimal offer-price tests that whole-number stripping and$1.99/$2/$2.00cases are unaffected.