diff --git a/customer-spa/src/App.tsx b/customer-spa/src/App.tsx index f9bb995..097d35f 100644 --- a/customer-spa/src/App.tsx +++ b/customer-spa/src/App.tsx @@ -56,14 +56,25 @@ function App() { const appearanceSettings = getAppearanceSettings(); const toastPosition = (appearanceSettings?.general?.toast_position || 'top-right') as any; + // Get initial route from data attribute (set by PHP based on SPA mode) + const getInitialRoute = () => { + const appEl = document.getElementById('woonoow-customer-app'); + const initialRoute = appEl?.getAttribute('data-initial-route'); + return initialRoute || '/shop'; // Default to shop if not specified + }; + + const initialRoute = getInitialRoute(); + return ( + {/* Root route redirects to initial route based on SPA mode */} + } /> + {/* Shop Routes */} - } /> } /> } /> @@ -78,8 +89,8 @@ function App() { {/* My Account */} } /> - {/* Fallback */} - } /> + {/* Fallback to initial route */} + } />