Repository navigation
Add currency symbol handling to product price functions - #16976
Merged
Merged
Conversation
peranosborn
requested review from
SolomonTheGuardian and
ecguardian
and
a balanced review from Copilot
October 20, 2026 11:58
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The thousands-separator test needs to detect the reported strikethrough regression rather than pass with the original parser.
1 open issue
What changed in this PR
Fixes currency display and price comparisons for affiliate products using live prices.
Changes:
- Preserves currency symbols in lowest-price displays.
- Removes dollar symbols and commas before comparing article prices.
- Updates unit tests for currency symbols and live-price handling.
| File | Description |
|---|---|
dotcom-rendering/src/model/enhanceProductElement.ts |
Includes currency symbols in live lowest prices. |
dotcom-rendering/src/model/enhanceProductElement.test.ts |
Checks pound and dollar lowest-price displays. |
dotcom-rendering/src/components/AffiliateProducts/livePriceUtils.tsx |
Corrects dollar and thousands-separator parsing. |
dotcom-rendering/src/components/AffiliateProducts/livePriceUtils.test.tsx |
Adds live-price rendering tests. |
Review effort: Balanced
…parated price parsing fix' Co-authored-by: Copilot Autofix powered by AI <[email protected]>
peranosborn
enabled auto-merge
October 20, 2026 12:50
🚀 Image pushed to AWS ECRImage digest: 🐛 Run the image locallyThe following can be used to run the image locally: # Refer to image using the immutable digest. Find alternatives below.
IMAGE_IDENTIFIER="@sha256:da10a100123b1a66d799974c97f3202506411483113b9ff64f48ed55ef11f57a"
# Refer to image using branch tag
# IMAGE_IDENTIFIER=":branch-po-fix-missing-currency-symbol"
# Refer to image using build tag
# IMAGE_IDENTIFIER=":build-32648"
# Set environment variables for the AWS CLI
AWS_PROFILE="<A_PROFILE_FROM_JANUS>"
AWS_DEFAULT_REGION="eu-west-1"
IMAGE_ACCOUNT_ID=$(aws ssm get-parameter --name /organisation/accounts/artifacts --query "Parameter.Value" --output text)
REGISTRY="${IMAGE_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com"
IMAGE="${REGISTRY}/guardian/dotcom-rendering/dotcom-rendering${IMAGE_IDENTIFIER}"
# Login to AWS ECR https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html
aws ecr get-login-password | docker login --username AWS --password-stdin $REGISTRY
# Pull the image
docker pull $IMAGE
# Run the image. You'll likely need to set additional flags. See https://docs.docker.com/reference/cli/docker/container/run.
docker run $IMAGEFrom guardian/actions-ecr. |
peranosborn
disabled auto-merge
October 20, 2026 13:40
peranosborn
enabled auto-merge
October 20, 2026 13:40
|
Seen on PROD (merged by @peranosborn 5 minutes and 45 seconds ago) Please check your changes! |
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.

What does this change?
Fixes a bug where the currency symbol was missing from the lowest price when a live price was used, and correctly parses $ prices and prices with commas (e.g. £1,299) when comparing them with the live price.
Why?
Live prices store the currency symbol separately from the number, so the lowest price showed a bare 129 instead of £129 whenever a live price was used. Separately, the old price parsing never removed $ and stopped at commas. As a result, $ products never showed their live price on product cards, and prices like £1,299 were read as £1, so real price drops didn't get the strikethrough.
How has this change been tested?
Unit tests: the lowest-price tests now expect the currency symbol (e.g. £19.99 rather than 19.99), and a new test checks that a $ live price keeps its symbol ($9.99). New getProductCtaLivePrice tests cover a $ price using the live price and a price with a comma (£1,299).
Screenshots