From 6ca99fa1189269765d2c726d4ed5c6e071601288 Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 07:05:07 +0100 Subject: [PATCH] Fix cart clearing when navigating to checkout The handleCheckout function on the cart page was navigating to /checkout without setting the isCheckingOut flag, causing LogoutOnUnload to clear the cart during navigation. Now sets the flag BEFORE navigating so LogoutOnUnload skips clearing the cart. Co-Authored-By: Claude Haiku 4.5 --- src/app/cart/page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/cart/page.tsx b/src/app/cart/page.tsx index 9669759..a18b321 100644 --- a/src/app/cart/page.tsx +++ b/src/app/cart/page.tsx @@ -17,6 +17,11 @@ export default function CartPage() { useEffect(() => setMounted(true), []); const handleCheckout = () => { + // Set flag so LogoutOnUnload doesn't clear cart during navigation to checkout + if (typeof window !== 'undefined') { + sessionStorage.setItem('isCheckingOut', 'true'); + console.log('💳 Cart checkout button clicked - set isCheckingOut flag'); + } window.location.href = '/checkout'; };