Skip to main content

ItemsOverview

A read-only cart items display component that renders each line item as a compact row with optional image, SKU, quantity, availability, and price. Supports normal products, cluster items with child variants, and bundle items with leader/non-leader breakdown.

Usage

import ItemsOverview from '@/components/propeller/ItemsOverview';

// Minimal — show all cart items with default settings (all columns visible)
<ItemsOverview cart={cart} />

// Checkout sidebar — read-only, no clicking, no availability
<ItemsOverview
cart={cart}
title="Order Summary"
showAvailability={false}
itemNameClickable={false}
/>

// Clickable items with navigation to product pages
<ItemsOverview
cart={cart}
onCartItemNameClick={(item) => router.push(`/product/${item.product?.slug}`)}
/>

// Minimal display — images and prices only, no SKU or stock info
<ItemsOverview
cart={cart}
showSku={false}
showAvailability={false}
showQuantity={false}
/>

// Custom price formatting and labels (e.g., for a non-EUR store)
<ItemsOverview
cart={cart}
formatPrice={(price) => `$${price.toFixed(2)}`}
labels={{
quantity: 'Amount:',
inStock: 'Available',
outOfStock: 'Unavailable',
noItems: 'Your cart is empty.',
}}
/>

// Styled container with custom CSS class
<ItemsOverview
cart={cart}
itemsOverviewContainerClass="bg-white rounded-lg p-4 shadow-sm"
title="Your Items"
/>

Configuration

Required

PropTypeDescription
cartCartShopping cart object. Items are read from cart.items.

Display Toggles

All default to true. Set to false to hide the corresponding column.

PropTypeDefaultDescription
showImagebooleantrueShow a 64x64 product thumbnail. Falls back to an SVG placeholder when no image URL is available.
showSkubooleantrueShow the product SKU below the item name.
showQuantitybooleantrueShow the item quantity (e.g., "Qty: 3").
showAvailabilitybooleantrueShow stock status text. Green for in-stock, red for out-of-stock.
showPricebooleantrueShow the line total price (unit price multiplied by quantity).

Interaction

PropTypeDefaultDescription
itemNameClickablebooleantrueWhen true, item names render as clickable text with hover styling.
onCartItemNameClick(item: CartMainItem) => voidundefinedCallback fired when a clickable item name is clicked. Receives the full CartMainItem. Only fires when itemNameClickable is true.

Customization

PropTypeDefaultDescription
titlestringundefinedOptional heading rendered above the items list as an <h2>.
itemsOverviewContainerClassstring'cart-items-overview'CSS class applied to the outermost container <div>.
formatPrice(price: number) => stringInternal formatterCustom price formatting function. The default formats as EUR with two decimals (e.g., "EUR 12.50").
labelsRecord<string, string>{}Override default label strings. Supported keys: quantity (default "Qty:"), inStock (default "In stock"), outOfStock (default "Out of stock"), noItems (default "No items in cart.").

Labels

KeyDefaultDescription
quantity"Qty:"Quantity label prefix
inStock"In stock"Stock status for available items
outOfStock"Out of stock"Stock status for unavailable items
noItems"No items in cart."Empty state message

Behavior

  • Three item types: The component handles three item shapes transparently. If item.bundle is present, it renders as a bundle with leader/non-leader breakdown. If item.childItems has entries, it renders as a cluster item with nested children. Otherwise, it renders as a standard line item.
  • Image fallback: When no valid image URL is found (missing, empty, or not starting with "http"), an inline SVG placeholder icon is shown instead.
  • Price calculation: Line total is computed as item.price * item.quantity. For bundles, bundle.price.net and each bundleItem.price.net are displayed directly without multiplication.
  • Stock status: Availability text is color-coded: green (text-green-600) for in-stock items, red (text-red-500) for out-of-stock. Only shown for non-bundle items.
  • Empty state: When cart.items is empty, a styled italic message is displayed using the noItems label.
  • Clickable names: When itemNameClickable is true and onCartItemNameClick is provided, item names get cursor-pointer styling with a hover color transition. Bundle names are never clickable.
  • Bundle layout: Bundles display the bundle name and total price at the top, followed by an indented list (left-bordered) showing the leader item (styled slightly bolder) and all non-leader items below it.
  • Cluster layout: Cluster items display the parent product name and price, followed by an indented list of child variant items showing their names and individual totalSum values.

SDK Services and Cart Fields

This component is read-only and does not call any SDK services. It receives a Cart object via props and reads the following fields:

From Cart

FieldUsage
cart.itemsArray of CartMainItem objects to iterate over.

From each CartMainItem

FieldUsage
item.itemIdUsed as the React key for each row.
item.product.names[0].valueDisplayed as the item name. Falls back to "Product".
item.product.skuDisplayed when showSku is enabled.
item.product.media.images.items[0].imageVariants[0].urlProduct thumbnail URL. Must start with "http" to be used.
item.product.inventory.totalQuantityDetermines stock status text and color. > 0 = in stock, 0 or missing = out of stock.
item.priceUnit price. Multiplied by item.quantity for the line total.
item.quantityDisplayed in the quantity label and used for price calculation.
item.childItemsArray of CartBaseItem for cluster variant children. Each child displays its product.names[0].value and totalSum.
item.bundleWhen present, the item renders as a bundle instead of a normal product.

From item.bundle (Bundle Items)

FieldUsage
bundle.nameDisplayed as the bundle title. Falls back to "Bundle".
bundle.price.netBundle-level price, shown next to the bundle name.
bundle.itemsArray of BundleItem objects. Split into leader and non-leaders.
bundle.items[].isLeaderCompared against Enums.YesNo.Y to identify the bundle leader.
bundle.items[].product.names[0].valueName of each bundle component product.
bundle.items[].price.netPrice of each bundle component.