fix(core-tabs): Create Shopping Cart Correctly

Ref: #5480
This commit is contained in:
Nino
2025-11-13 17:48:11 +01:00
parent 83292836a3
commit 2ea76b6796

View File

@@ -167,9 +167,10 @@ export const canDeactivateTabCleanup: CanDeactivateFn<unknown> = 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<unknown> = async () => {
log.info('Tab reset to clean state', () => ({
tabId,
name: tabName,
newShoppingCartId: newShoppingCart.id,
}));
return true;