wp-calypso
wp-calypso copied to clipboard
Plans Grid: fix billing timeframe with upgrade credits
Related to pbOQVh-4Wn-p2
Proposed Changes
- When upgrade credits are available, discounted pricing should not be shown on the pricing grid. We fixed this for the
< PlanFeatures2023GridHeaderPrice />
component via #86860, but the same logic was not applied for the billing timeframe. - In this PR, we add this check to the
usePlanBillingDescription
hook.
Note: When working on this PR, I realized that this bit of logic is critical to how plan prices are shown and probably should not be the responsibility of the components that display pricing. Going forward, if we add another way to display prices, the same logic would have to be repeated. IMO, this logic should be centralized and should be a part of the usePricingMetaForGridPlans
hook. If upgrade credits are available, this hook should always return discounted prices as null
.
EDIT: A recent manifestation of the issue: https://github.com/Automattic/wp-calypso/issues/92210
We can ship this PR for now as a temporary fix and then iterate on adding this logic to usePricingMetaForGridPlans
or wherever it is most appropriate.
Why are these changes being made?
- Bug fix for pbOQVh-4Wn-p2.
Testing Instructions
- IMP: Disable the store sandbox if it is enabled. (34e98-pb)
- Switch currency to INR.
- Go to
/plans/<site slug>
for a site on the Creator monthly plan. - In the interval dropdown, select the yearly option.
- Confirm that the billing timeframe shows the correct price.
Production | This PR |
---|---|
Pre-merge Checklist
- [ ] Has the general commit checklist been followed? (PCYsg-hS-p2)
- [ ] Have you written new tests for your changes?
- [ ] Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
- [ ] Have you checked for TypeScript, React or other console errors?
- [ ] Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
- [ ] Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
- [ ] For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?