-
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
DIFM Signup: Redirect user to /home
after they cancel DIFM checkout
#95183
Conversation
This diff hijacks the 'website-content' step in order to check the value of the `?skippedCheckout=1` query param. If it's set then we go straight to My Home otherwise an error is shown - since the purchase is never completed, the DIFM data isn't set up and that's why there's an error on this page. The checkout page usually supports both `?redirect_to` and `?cancel_to` query params that let you go to a different location if the user cancels the checkout. Unfortunately the signup framework only gives the ability to set a single "destination" for a flow. https://github.com/Automattic/wp-calypso/blob/cf0aa1a007213a6cfcf40b420acd7f4b9c1d8441/client/signup/config/flows-pure.js#L506 For reference, the `?skippedCheckout=1` param is set here: https://github.com/Automattic/wp-calypso/blob/cf0aa1a007213a6cfcf40b420acd7f4b9c1d8441/client/signup/config/flows.js#L58
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Async-loaded Components (~84 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.
✅ Tested and redirects backs to /home/:site
TestingRequirementsFor each of the flows listed below:
Browsers
NotesI'm having trouble getting this to work with calypso.live. I'm going to try things locally. 🤔 Edit: Things work as expected locally |
@@ -300,6 +302,13 @@ export default function WrapperWebsiteContent( | |||
} | |||
}, [ data, queryObject.siteSlug ] ); | |||
|
|||
useEffect( () => { | |||
if ( skippedCheckout === '1' ) { |
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.
Nonblocking:
This seems totally reasonable for a patch.
I'm a bit surprised this isn't already handled at a level above individual steps 🤔 It sounds like Philip already pinpointed the reason in the PR description. "Unfortunately the signup framework only gives the ability to set a single "destination" for a flow."
What we want to do here seems like a valid use case though. @alshakero wondering if you have thoughts.
Ah just realized that this isn't part of the stepper onboarding framework. Apologies for the premature ping Omar 🙏 In that case, barring a rework of the signup framework, this seems like a good solution for the time being.
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.
Yeah it's not necessarily a bad thing to expect the checkout destination to handle both the the success and cancelation cases. You could imagine the flow doing something nice like acknowledging they didn't pay, offering a discount, giving them alternative solutions etc.
On the other hand, it could save a redirect bounce if you could set the cancel_to
param up front 🤷♂️
@p-jackson can you add a reference to the original issue? :) |
@autumnfjeld no original issue, I discovered during my own testing. But I can create a dummy issue if that makes it easier for counting the bug fixes? |
Ah ok. I made an assumption this was related to other work since Quake had recently worked on issues with the DIFM flow. No need to add create a dummy issue. |
Actually, for GK tracking it might be wise to always create a dummy issue. Let's discuss a convention for the team. :) p1729548316342259/1729545282.865209-slack-C04H4NY6STW |
Proposed Changes
This diff hijacks the 'website-content' step in order to check the value of the
?skippedCheckout=1
query param. If it's set then we go straight to My Home otherwise an error is shown - since the purchase is never completed, the DIFM data isn't set up and that's why there's an error on this page.The checkout page usually supports both
?redirect_to
and?cancel_to
query params that let you go to a different location if the user cancels the checkout. Unfortunately the signup framework only gives the ability to set a single "destination" for a flow.wp-calypso/client/signup/config/flows-pure.js
Line 506 in cf0aa1a
For reference, the
?skippedCheckout=1
param is set here:wp-calypso/client/signup/config/flows.js
Line 58 in cf0aa1a
Testing Instructions
For reference, the DIFM flows are linked to from the logged-out landing page https://wordpress.com/website-design-service/
/start/do-it-for-me/new-or-existing-site?ref=do-it-for-me-lp
flow/start/do-it-for-me-store/?utm_campaign=happiness
flowPre-merge Checklist