From 6920fe831b52d0380f8e96758b83612e4a51814e Mon Sep 17 00:00:00 2001 From: Nate Weller Date: Mon, 19 Aug 2024 09:46:06 -0600 Subject: [PATCH] My Jetpack: fix postCheckoutUrl in product interstitial component (#38704) --- .../_inc/components/product-interstitial/index.jsx | 10 ++-------- .../changelog/fix-my-jetpack-post-checkout-urls | 4 ++++ 2 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 projects/packages/my-jetpack/changelog/fix-my-jetpack-post-checkout-urls diff --git a/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx b/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx index 3b11e52e1ee41..645c680087767 100644 --- a/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx @@ -131,10 +131,6 @@ export default function ProductInterstitial( { const clickHandler = useCallback( ( checkout, product, tier ) => { - let postCheckoutUrl = product?.postCheckoutUrl - ? product?.postCheckoutUrl - : myJetpackCheckoutUri; - ctaCallback?.( { slug, product, tier } ); if ( product?.isBundle || directCheckout ) { @@ -146,10 +142,8 @@ export default function ProductInterstitial( { activate( { productId: slug }, { - onSettled: ( { productId: activatedProduct } ) => { - postCheckoutUrl = activatedProduct?.post_checkout_url - ? activatedProduct.post_checkout_url - : myJetpackCheckoutUri; + onSettled: activatedProduct => { + const postCheckoutUrl = activatedProduct?.post_checkout_url || myJetpackCheckoutUri; // there is a separate hasRequiredTier, but it is not implemented const hasPaidPlanForProduct = product?.hasPaidPlanForProduct; const isFree = tier diff --git a/projects/packages/my-jetpack/changelog/fix-my-jetpack-post-checkout-urls b/projects/packages/my-jetpack/changelog/fix-my-jetpack-post-checkout-urls new file mode 100644 index 0000000000000..a91aaa758c235 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-my-jetpack-post-checkout-urls @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +My Jetpack: ensure product screens redirect to the correct post-checkout URLs.