From bf8a0314314e5387ddbbb42125539f3ce7822701 Mon Sep 17 00:00:00 2001 From: Paulo Trentin Date: Sat, 1 Feb 2025 17:41:37 -0300 Subject: [PATCH] Fix the exit checkout flow by proper redirecting back to /plans page --- client/landing/stepper/declarative-flow/onboarding.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/landing/stepper/declarative-flow/onboarding.ts b/client/landing/stepper/declarative-flow/onboarding.ts index 283e2695587996..16dd5799f892a9 100644 --- a/client/landing/stepper/declarative-flow/onboarding.ts +++ b/client/landing/stepper/declarative-flow/onboarding.ts @@ -350,12 +350,19 @@ const onboarding: Flow = { if ( providedDependencies.goToCheckout ) { const siteSlug = providedDependencies.siteSlug as string; + const checkoutBackUrl = + createWithBigSky && isBigSkyBeforePlansExperiment && isGoalsAtFrontExperiment + ? '/setup/onboarding/plans' + : destination; + // replace the location to delete processing step from history. window.location.replace( addQueryArgs( `/checkout/${ encodeURIComponent( siteSlug ) }`, { redirect_to: destination, signup: 1, - checkoutBackUrl: pathToUrl( addQueryArgs( destination, { skippedCheckout: 1 } ) ), + checkoutBackUrl: pathToUrl( + addQueryArgs( checkoutBackUrl, { skippedCheckout: 1 } ) + ), coupon, } ) );