# Ecommerce Shopping Cart: Floating Cart

A cart that floats over the page as a small overlay, showing added items and a subtotal. Lets shoppers review picks without leaving the product they browse.

- Page: https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/floating-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/floating-cart.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/ecommerce-shopping-cart-floating-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-floating-cart.json"`.

## Depends on

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

## About this block

Floating Cart sits fixed in the bottom-right corner of the viewport.
A circular toggle button opens and closes the panel. When open, a card
slides up from the button showing a scrollable item list, each row
containing a thumbnail, product name, color and size attributes, an
inline quantity stepper, a line total with an optional crossed-out
original price, and a trash icon to remove the item. Below the item
list an order summary section shows subtotal, shipping (waived
automatically when the order clears $200), and total. A footer row
carries a free-shipping notice, a primary checkout button, and a
secondary view-cart link.

Every piece of copy and every item is independent. You can swap
product names, prices, and images, change the free-shipping threshold,
add or remove cart entries, or drop the view-cart link entirely without
affecting the overlay mechanics.

## When to use

Use this block when a shopper needs to see cart contents without
navigating away from a browsing or selection view. It suits a
logistics and delivery platform where operators are adding multiple
service packages or delivery slots to an order and need to confirm
running totals while still choosing options. It outperforms an
inline cart section on pages where screen real estate is shared with
product grids or configuration panels, since the overlay appears only
on demand.

A natural flow around it on an Ecommerce page:

**Before**

- [Product Overview](https://www.shadcn-ui-blocks.com/blocks/ecommerce/product-overview) so shoppers
  have a detail view from which to add items before the cart appears
- [Category Filters](https://www.shadcn-ui-blocks.com/blocks/ecommerce/category-filters) to let
  operators narrow the service catalog before building an order

**After**

- [Bundle Upsells](https://www.shadcn-ui-blocks.com/blocks/ecommerce/ecommerce-bundle-upsells) shown
  after the cart opens to surface add-ons at the right moment
- [Trust Guarantee](https://www.shadcn-ui-blocks.com/blocks/ecommerce/ecommerce-trust-guarantee) to
  reinforce confidence just before the checkout step

## What you can customize

The block has three clearly separated regions you can edit
independently:

- **Item list.** Add as many cart entries as the use case needs. The
  list scrolls when it grows tall, so it never pushes the order
  summary off screen.
- **Pricing and shipping logic.** The free-shipping threshold and the
  crossed-out original price are both optional values. Remove the
  threshold notice or the original price field when they do not apply
  to your service model.
- **Footer actions.** The checkout button and the view-cart link are
  separate controls. Drop the secondary link if your flow goes
  straight to checkout, or swap its label and destination to match
  your routing.

> Tip: keep the item list to three or four entries in the demo state
> so the panel fits the viewport without scrolling on first open.

## More in Ecommerce Shopping Cart

- [Compact Cart](https://www.shadcn-ui-blocks.com/blocks/ecommerce/shopping-cart/compact-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)
