# Ecommerce Shopping Cart: Compact Cart

A condensed cart panel listing items, quantities, and a running total in tight space. Fits a header dropdown or a narrow column without crowding the layout.

- Page: https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/compact-cart
- Collection: [Ecommerce](https://www.shadcn-ui-blocks.com/blocks/ecommerce), Free tier
- Group: [Shopping Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart)
- Created: 2026-06-14
- Preview image: https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/compact-cart.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/ecommerce-shopping-cart-compact-cart
```

A free block: it installs with no account or key. Or install it by URL: `npx shadcn@latest add "https://www.shadcn-ui-blocks.com/r/ecommerce-shopping-cart-compact-cart.json"`.

## Depends on

- npm packages: class-variance-authority, lucide-react, radix-ui
- shadcn/ui components: button, card, sheet
- Installs to: `@/components/blocks/ecommerce/shopping-cart/compact-cart`

## About this block

Compact Cart opens as a slide-in sheet panel triggered by a cart icon
button that shows a live item count badge. Inside the panel a header
names the sheet and states how many items are present. Below it each
cart item renders as a card with a square product thumbnail on the
left and, on the right, the product name, a color and size note, a
trash button, a plus/minus quantity stepper capped to available stock,
the running line total, and a struck-through original price when a
discount exists. An Order Summary card below the item list shows
subtotal, shipping, and total, a free shipping threshold note, and a
full-width checkout button.

Each piece is independently editable. You can swap product names,
images, variant labels, prices, and stock limits without touching the
panel structure. The shipping cost and free-shipping threshold are
plain constants, so adjusting them takes a one-line change. Items can
be added or removed from the initial list freely, and the item count
badge and all totals update automatically.

## When to use

Reach for this block when you need a cart that lives inside a header
or a narrow sidebar column rather than taking over the full page. For
an AI assistant product that sells usage plans, add-on credits, or
tool packs, this panel lets a customer review their selections and
adjust quantities without leaving the pricing or feature page they
were reading. It fits better than a full cart page in contexts where
the primary goal is a quick review before committing, and better than
a floating overlay when you want the panel anchored to one side of
the viewport.

A natural flow around it on an Ecommerce page:

**Before**

- A [Product Overview](https://www.shadcn-ui-blocks.com/blocks/ecommerce/product-overview) block so
  shoppers land on a clear product detail before adding to cart
- A [Product List](https://www.shadcn-ui-blocks.com/blocks/ecommerce/product-list) so customers can
  browse and add multiple items in one pass

**After**

- [Trust Guarantee](https://www.shadcn-ui-blocks.com/blocks/ecommerce/ecommerce-trust-guarantee)
  blocks to reinforce confidence just below the cart entry point
- A [Shipping Returns](https://www.shadcn-ui-blocks.com/blocks/ecommerce/ecommerce-shipping-returns)
  section so buyers see policy details right after reviewing their
  cart

## What you can customize

The panel is built from three separable parts, each of which you can
edit in isolation:

- **Item cards.** Swap the product name, thumbnail, variant labels,
  price, original price, and stock ceiling per item without changing
  the stepper or remove logic.
- **Order Summary card.** Adjust the flat shipping fee or the free
  shipping threshold copy to match your actual fulfillment rules.
- **Trigger button.** Replace the cart icon with any button label or
  icon that fits your header, since the sheet opens from whatever
  element you pass as the trigger.

> Tip: cap your demo item list at three or four entries so the panel
> stays scannable without requiring the user to scroll before they
> reach the checkout button.

## More in Ecommerce Shopping Cart

- [Floating Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/floating-cart)
- [Mini Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/mini-cart)
- [Modern Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/modern-cart)
- [Sidebar Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/sidebar-cart)
- [Sticky Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/sticky-cart)
