Product Card
The shared tile that displays a product's image, title, and price in grids and sliders.
Used in the home featured grid, collection (PLP) and search grids, the related-products slider on the PDP, and the AI agent's results. It is a compound component, so each piece can be composed independently while sharing the same styling hooks.
Composition
ProductCard is a server component that wraps the product in a Link to /products/[handle] (appending ?variant= when a default variant id is known). Each part — image container, image, content, title, price, optional badge — exposes a data-slot attribute (product-card, product-card-image, etc.) as a stable styling hook.
Variants
variant is either default or featured:
default- the standard tile used in grids and sliders.featured- adds a "Featured" badge (clipped corner ribbon) and a top-down gradient behind the image container. Used for highlighting hero products.
The badge label comes from the product.featuredBadge translation key, so it stays localized.
Aspect ratio
ProductCardImage accepts aspectRatio of square (default), portrait, or landscape, applied via data-[aspect-ratio=...] selectors. The skeleton honors the same prop so the placeholder matches the loaded card.
Image fallback
The card renders product.featuredImage with next/image (fill, object-cover). When a product has no featured image, the card does not show a broken image - the image box keeps its aspect-ratio footprint (with a bg-muted background) and renders the product title centered as muted placeholder text. This keeps grids visually aligned even for products that are missing imagery.
When the product is unavailable, an out-of-stock overlay darkens the image and shows the localized out-of-stock label on top.
The card uses a single image by default. It intentionally does not ship a hover image carousel - see the recipe below to add one.
Skeleton
ProductCardSkeleton mirrors the card's footprint - an aspect-ratio image block plus title and price bars - for use in Suspense fallbacks and during infinite-scroll loads.
Recipes
Customizations you can apply to the card. Each recipe is a single prompt - paste it into your coding agent and let it implement the change.
Add a hover image carousel
By default the card shows only the featured image. The template previously shipped a desktop hover carousel that revealed additional product images; it was removed as a default to keep grids lean and avoid fetching extra images on every card. This recipe re-adds it as an opt-in feature.
Key files
| File | Purpose |
|---|---|
components/product-card/product-card.tsx | High-level server component and link wrapper |
components/product-card/components.tsx | Compound parts, image/fallback, skeleton |
lib/shopify/fragments.ts | PRODUCT_CARD_FRAGMENT (card data shape) |
lib/shopify/transforms/product.ts | transformShopifyProductCard |
lib/types.ts | ProductCard domain type |