Subscription gifts need to be all or nothing — for example, if someone manages to gift a plan renewal but not the corresponding primary domain renewal that was automatically added to the shopping cart, then the site would likely break when the domain expires, so it would have wound up being a confusing and not very useful gift.
Currently, this is mostly enforced on the server, but the user experience is bad — for example, trying to remove the gift domain renewal from the cart does nothing (pdtkmj-Ks-p2#comment-1269).
This pull request makes it so removing any gift product from the cart automatically removes all the others, and changes the confirmation message for removing a gift (which previously didn’t quite make sense for someone gifting a subscription to someone else’s site) to match.
Before (removing a plan or domain, and in some cases the removal wouldn’t actually work after you press “Continue”):
After (removing either the plan or the domain):
The easiest way to test this is to have a site with a Personal plan and custom domain, where the custom domain is set to primary, and where subscription gifting is turned on via
Log in as a different user, and visit a URL like
/checkout/personal-bundle/gift/[ID], where ID is the subscription ID (obtained from the server, or from the number in the URL when the original user clicks through to manage their subscription from the Purchases page). This should put the plan and domain renewal in your shopping cart as a gift.
Test that if you go to remove either the plan or domain from the cart, the expected confirmation message is shown, and that going through with the removal causes both products to be removed from the cart and the cart to be emptied.
- 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-ajp-p2)?
Unfortunately, no screenshots were provided by the developer.