Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/grid/three-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { getCollectionProducts } from 'lib/shopify';
import type { Product } from 'lib/shopify/types';
import Link from 'next/link';

const MINIMUM_PRODUCTS_QUANTITY = 3;

function ThreeItemGridItem({
item,
size,
Expand Down Expand Up @@ -47,7 +49,7 @@ export async function ThreeItemGrid() {
collection: 'hidden-homepage-featured-items'
});

if (!homepageItems[0] || !homepageItems[1] || !homepageItems[2]) return null;
if (homepageItems.length < MINIMUM_PRODUCTS_QUANTITY) return null;

const [firstProduct, secondProduct, thirdProduct] = homepageItems;

Expand Down