diff --git a/components/layout/product-grid-items.tsx b/components/layout/product-grid-items.tsx index b7903a52c..0c0e907ed 100644 --- a/components/layout/product-grid-items.tsx +++ b/components/layout/product-grid-items.tsx @@ -17,7 +17,7 @@ export default function ProductGridItems({ products }: { products: Product[] }) amount: product.priceRange.maxVariantPrice.amount, currencyCode: product.priceRange.maxVariantPrice.currencyCode }} - src={product.featuredImage.url} + src={product.featuredImage?.url} width={600} height={600} /> diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index af76e3e26..a2f45a36f 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -265,6 +265,11 @@ export async function getCollectionProducts(handle: string): Promise } }); + if (!res.body.data.collection) { + console.log('No collection found for handle', handle); + return []; + } + return reshapeProducts(removeEdgesAndNodes(res.body.data.collection.products)); }