diff --git a/app/[locale]/product/[handle]/page.tsx b/app/[locale]/product/[handle]/page.tsx index 2b8a97e2c..0d19171fa 100644 --- a/app/[locale]/product/[handle]/page.tsx +++ b/app/[locale]/product/[handle]/page.tsx @@ -2,6 +2,7 @@ import type { Metadata } from 'next'; import { notFound } from 'next/navigation'; import { Suspense } from 'react'; +import clsx from 'clsx'; import { AddToCart } from 'components/cart/add-to-cart'; import { GridTileImage } from 'components/grid/tile'; import Label from 'components/label'; @@ -64,13 +65,16 @@ export default async function ProductPage({ }: { params: { handle: string; locale?: SupportedLocale }; }) { + const numberOfOtherImages = 3; const product = await getProduct({ handle: params.handle, language: params?.locale?.toUpperCase() }); let otherImages: MediaImage[] = []; if (!!product) { - otherImages = product.images.filter((image) => image?.url !== product.featuredImage?.url); + otherImages = product.images + .slice(0, numberOfOtherImages + 1) // +1 to account for featured image + .filter((image) => image?.url !== product.featuredImage?.url); } if (!product) return notFound(); @@ -102,7 +106,7 @@ export default async function ProductPage({ />