diff --git a/packages/magento-store/utils/redirectOrNotFound.ts b/packages/magento-store/utils/redirectOrNotFound.ts index cdc29ecf8b..c7d1ae35f7 100644 --- a/packages/magento-store/utils/redirectOrNotFound.ts +++ b/packages/magento-store/utils/redirectOrNotFound.ts @@ -136,6 +136,12 @@ export async function redirectOrNotFound( : redirect(from, `/${redirectUrl}`, permanent, locale) } + // If no explicit redirect but route is a product, redirect to product route + if (routeData.route?.relative_url && isTypename(routeData.route, productInterfaceTypes)) { + const productPath = `${productRoute ?? '/p/'}${routeData.route.relative_url}` + return redirect(from, productPath, permanent, locale) + } + return notFound(from, 'Route found, but no redirect URL') } catch (e) { if (e instanceof Error) {