-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkout: add renewal gift route #69769
Conversation
This will clarify this this route differs from other siteless checkout flows.
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~168 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~41 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, just have questions.
Testing:
const product = isJetpackCheckout | ||
? context.params.productSlug | ||
: getProductSlugFromContext( context ); | ||
const product = getProductSlugFromContext( context ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR modifies getProductSlugFromContext()
to support determining isJetpackCheckout
on its own, which allows us to simplify this call.
NOTE: this will affect redirectJetpackLegacyPlans()
which also calls getProductSlugFromContext()
, but I think that should be fine since it's only used on non-Jetpack-siteless-checkout routes.
page( | ||
`/checkout/jetpack/:productSlug`, | ||
setLocaleMiddleware(), | ||
noSite, | ||
checkoutSiteless, | ||
checkoutJetpackSiteless, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR renames this controller from checkoutSiteless
to checkoutJetpackSiteless
to clarify the difference between this route and other siteless checkout flows.
@pottedmeat could you give this another try just to make sure I didn't break anything?
When this happened, were there any errors in the console? |
No errors. |
I've created #69833 to investigate this. |
Proposed Changes
This PR adds a new checkout route of the form
/checkout/:productSlugs/gift/:purchaseIds
to enable gifting subscription renewals to other WordPress.com users (see pbOQVh-2wh-p2 for more details). An example URL might be/checkout/business-bundle-monthly,dotblog_domain/gift/10000,100001
to gift two products.The new route works similarly to the current route for adding a renewal to the cart, which is
/checkout/:productSlugs/renew/:purchaseIds/:domain
. Both routes will attempt to add renewal products to the cart, but the gift route will allow adding a renewal for a different user. The user purchasing the gift does not need to have a WordPress.com site but does need to have an account.Fixes https://github.com/Automattic/payments-shilling/issues/1194
(Most of this work was already prepared in the POC #69639 by @dylanrevisited)
Testing Instructions
You'll need two accounts and make sure that the store is sandboxed.
/checkout/personal-bundle/gift/<ACCOUNT_A_SUBSCRIPTION_ID>
. You can use Store Admin to find the subscription ID of the account A's plan.