Skip to content

Commit

Permalink
Handle checkout redirection path for the site context
Browse files Browse the repository at this point in the history
  • Loading branch information
bogiii committed Jan 15, 2025
1 parent d9efb03 commit 32574e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/my-sites/email/add-mailboxes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import { TITAN_PROVIDER_NAME } from 'calypso/lib/titan/constants';
import useCartKey from 'calypso/my-sites/checkout/use-cart-key';
import {
domainManagementAllEmailRoot,
domainSiteContextRoot,
isUnderDomainManagementAll,
isUnderDomainSiteContext,
} from 'calypso/my-sites/domains/paths';
import AddEmailAddressesCardPlaceholder from 'calypso/my-sites/email/add-mailboxes/add-users-placeholder';
import EmailProviderPricingNotice from 'calypso/my-sites/email/add-mailboxes/email-provider-pricing-notice';
Expand Down Expand Up @@ -328,7 +330,10 @@ const MailboxesForm = ( {

if ( isUnderDomainManagementAll( currentRoute ) ) {
const newEmail = mailboxOperations.mailboxes[ 0 ].getAsCartItem().email;
const redirectTo = `${ domainManagementAllEmailRoot() }/${ selectedDomainName }/${ selectedSiteSlug }?new-email=${ newEmail }`;
const redirectTo = isUnderDomainSiteContext( currentRoute )
? `${ domainSiteContextRoot() }/email/${ selectedDomainName }/${ selectedSiteSlug }?new-email=${ newEmail }`
: `${ domainManagementAllEmailRoot() }/${ selectedDomainName }/${ selectedSiteSlug }?new-email=${ newEmail }`;

checkoutPath += '?redirect_to=' + encodeURIComponent( redirectTo );
}

Expand Down

0 comments on commit 32574e3

Please sign in to comment.