From 2ea76b6796991d3b2bb99085c75d4d922705d485 Mon Sep 17 00:00:00 2001 From: Nino Date: Thu, 13 Nov 2025 17:48:11 +0100 Subject: [PATCH] fix(core-tabs): Create Shopping Cart Correctly Ref: #5480 --- libs/core/tabs/src/lib/tab-cleanup.guard.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/core/tabs/src/lib/tab-cleanup.guard.ts b/libs/core/tabs/src/lib/tab-cleanup.guard.ts index bd27dfc75..dd8cb8154 100644 --- a/libs/core/tabs/src/lib/tab-cleanup.guard.ts +++ b/libs/core/tabs/src/lib/tab-cleanup.guard.ts @@ -167,9 +167,10 @@ export const canDeactivateTabCleanup: CanDeactivateFn = async () => { crmTabMetadataService.setSelectedPayerId(tabId, undefined); crmTabMetadataService.setSelectedShippingAddressId(tabId, undefined); - // Create new shopping cart for the cleaned tab - const newShoppingCart = await shoppingCartService.createShoppingCart(); - checkoutMetadataService.setShoppingCartId(tabId, newShoppingCart.id); + // Create new shopping cart and update Store (this automatically dispatches setShoppingCart action) + await firstValueFrom( + domainCheckoutService.createShoppingCart({ processId: tabId }), + ); // Clear tab metadata and location history, but keep process_type for cart icon tabService.patchTabMetadata(tabId, { process_type: 'cart' }); @@ -182,7 +183,6 @@ export const canDeactivateTabCleanup: CanDeactivateFn = async () => { log.info('Tab reset to clean state', () => ({ tabId, name: tabName, - newShoppingCartId: newShoppingCart.id, })); return true;