Skip to content

Commit

Permalink
fix: checkout not redirecting to registration form when creating an a…
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and libruce committed Feb 22, 2024
1 parent 847a5ad commit dd7d2d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/storefront/src/utils/b3AccountItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ const openPageByClick = ({
isRegisterAndLogin,
isAgenting,
}: OpenPageByClickProps) => {
if (href?.includes('register')) {
return '/register'
}
if (href?.includes('/orders')) {
return role !== 100 ? '/orders' : '/login'
}
Expand Down
2 changes: 1 addition & 1 deletion packages/global-b3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const themeOtherElementConfig = () => {

const globalB3 = {
'dom.registerElement':
'[href^="/login.php"], #checkout-customer-login, [href="/login.php"] .navUser-item-loginLabel',
'[href^="/login.php"], #checkout-customer-login, [href="/login.php"] .navUser-item-loginLabel, #checkout-customer-returning .form-legend-container [href="#"]',
'dom.registerUrl': '/register',
'dom.checkoutRegisterParentElement': '#checkout-app',
'dom.navUserLoginElement': '.navUser-item.navUser-item--account',
Expand Down
7 changes: 7 additions & 0 deletions packages/hooks/useB3AppOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ export const useB3AppOpen = (initOpenState: OpenPageState) => {
href = isLogin ? '/orders' : '/login'
}

if (
window?.location?.pathname === '/checkout' &&
(e.target as HTMLAnchorElement)?.getAttribute('href') === '#'
) {
href = '/register'
}

if (
isLogin &&
href.includes('/login') &&
Expand Down

0 comments on commit dd7d2d0

Please sign in to comment.