Changes proposed in this Pull Request
I’m working on adding a first-year only promotional discount in 3 currencies. When a 1-st year discount is available, it should modify the discount fields and the plan prices, and display them on /plans, checkout, and the cart. A problem appeared while testing that this 1st-year discount causes /plans
and /sites/plans
to return different values for these discounts.
This change proposes a fix that would lead to reading both the price and the discount from /sites/plans as opposed to reading the price from /plans and the discount from /sites/plans if a siteId
is available.
The plans and sites/plans selectors use inconsistent naming and inconsistent arguments. I didn’t attempt to address that. I think it should be done with a separate change if time allows. These selectors should have names indicating which price is with the discount applied, and which is original. The word raw
indicates it’s a number, perhaps not necessary.
Testing instructions
- Enable the store sandbox
- Apply D48562-code (combines 2 diffs)
Test the Signup in MXN (or PHP, INR)
- In order to ensure the display of MXN, my recommendation would be to hardcode WPCOM_Store::get_user_currency to return MXN
- Sign up. You should see the plan step look like this, depending on the reskinSignupFlow variation:
- Remove the hardcoded MXN and reload the plans step
- Prices should be normal, no strikethrough, no changes in alignment
Test logged in Plans in MXN without plan credits
- Ensure the user sees prices in MXN (no need to hardcode for logged in users, it can be changed from Store Admin)
- Go to /plans. Prices should look like this
- There’s a tooltip that can be seen if the (i) is clicked:
4. Switch to another currency
Test logged in Plans in MXN with plan credits
- Buy a plan
- Ensure the currency is MXN
- Users should see the appropriate Bundle Upsell discount with no first-year promotional prices anywhere visible
- Switch to another currency
5. The plan credit notice is affected by this change, make sure it makes sense:
Unfortunately, no screenshots were provided by the developer.