Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Cart Quick Start

The Cart drop-in is one of the most commonly used components in the Commerce boilerplate. It provides a complete shopping cart experience with features like product management, coupon codes, gift cards, and shipping estimates.

Version: 3.0.0-beta3

Quick example

The Cart drop-in is included in the Commerce boilerplate . This example shows the basic pattern:

// 1. Import initializer (handles all setup)
import '../../scripts/initializers/cart.js';
// 2. Import the container you need
import CartSummaryGrid from '@dropins/storefront-cart/containers/CartSummaryGrid.js';
// 3. Import the provider
import { render as provider } from '@dropins/storefront-cart/render.js';
// 4. Render in your block
export default async function decorate(block) {
await provider.render(CartSummaryGrid, {
// Configuration options - see Containers page
})(block);
}

New to drop-ins? See the Using drop-ins guide for complete step-by-step instructions.

Quick reference

Import paths:

  • Initializer: import '../../scripts/initializers/cart.js'
  • Containers: import ContainerName from '@dropins/storefront-cart/containers/ContainerName.js'
  • Provider: import { render } from '@dropins/storefront-cart/render.js'

Package: @dropins/storefront-cart

Version: 3.0.0-beta3 (verify compatibility with your Commerce instance)

Example container: CartSummaryGrid

Learn more

  • Containers - Available UI components and configuration options
  • Initialization - Customize initializer settings and data models
  • Functions - Control drop-in behavior programmatically
  • Events - Listen to and respond to drop-in state changes
  • Slots - Extend containers with custom content