Skip to content

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

The Boilerplate

Blocks reference

This reference provides technical details for all 32 commerce blocks included in the boilerplate. Each block integrates one or more drop-in components to provide complete commerce functionality.

Boilerplate version: 4.0.1

Quick reference by functionality

BlockPrimary Drop-insKey Features
Shopping Experience
Product List Page storefront-product-discovery, tools, storefront-wishlistSearch, filtering, sorting, pagination, wishlist integration
Product Details tools, storefront-pdp, storefront-wishlistProduct options, pricing, add to cart, wishlist toggle
Product Recommendations tools, storefront-cart, storefront-recommendationsAI-powered recommendations, multiple page types
Cart tools, storefront-cart, storefront-wishlistItem management, coupon codes, gift options, move to wishlist
Mini Cart storefront-cart, toolsDropdown cart summary, quick view, checkout navigation
Checkout tools, storefront-order, storefront-checkoutComplete checkout flow, shipping, payment, order review
Customer Account
Login storefront-authEmail/password authentication, redirect handling
Create Account storefront-authRegistration form, validation, account creation
Confirm Account storefront-auth, toolsEmail confirmation landing, account activation
Forgot Password storefront-auth, toolsPassword reset request, email trigger
Create Password storefront-auth, toolsPassword reset form, token validation
Account Header toolsCustomer name display, logout functionality
Account Sidebar tools, storefront-accountAccount navigation menu, active state management
Addresses storefront-accountAddress CRUD operations, default address management
Customer Information storefront-accountProfile editing, email/name updates
Customer Details storefront-orderCustomer info display in order context
Order Management
Orders List storefront-account, toolsOrder history, status display, order details navigation
Search Order storefront-auth, storefront-order, toolsGuest order lookup, email and order number validation
Order Header toolsOrder number, date, status badge
Order Status storefront-orderDetailed status, tracking info, delivery estimates
Order Product List storefront-order, storefront-cart, toolsLine items, reorder functionality, product images
Order Cost Summary storefront-orderSubtotal, taxes, shipping, discounts, grand total
Shipping Status storefront-order, toolsShipment tracking, carrier info, delivery status
Returns & Exchanges
Returns List storefront-order, toolsReturn history, status tracking, return details navigation
Create Return storefront-order, toolsReturn request form, item selection, reason codes
Order Returns tools, storefront-orderReturn details for specific order
Return Header toolsReturn number, date, status display
Gift Options
Gift Options storefront-cartGift messages, gift wrapping, gift receipt options
Wishlist
Wishlist storefront-cart, storefront-pdp, storefront-wishlistSaved items, move to cart, item management

Integration patterns

Block decoration flow

Every commerce block follows this initialization pattern:

  1. Server-side rendering: Edge Delivery Services transforms the document table into HTML
  2. Client-side decoration: The block’s JavaScript decorator runs via decorateBlock()
  3. Drop-in initialization: Drop-in containers are initialized with configuration and providers
  4. Rendering: Drop-in components render into the block’s DOM
  5. Event handling: Event listeners connect to the global event bus

Common integration patterns

Simple drop-in rendering

Blocks like Login and Forgot Password simply render a single drop-in container:

export default async function decorate(block) {
const { render } = await import('@dropins/storefront-auth/containers/SignIn.js');
await render(SignInContainer, {})({});
}

Multi-drop-in coordination

Complex blocks like Cart and Checkout coordinate multiple drop-ins:

// Cart block uses cart + wishlist drop-ins
import { render as renderCart } from '@dropins/storefront-cart/containers/Cart.js';
import { render as renderWishlist } from '@dropins/storefront-wishlist/api.js';

Configuration from block tables

Blocks read configuration from document authoring tables:

const config = readBlockConfig(block);
const hideHeading = config['hide-heading'] === 'true';

Event bus integration

Blocks listen to events from drop-ins and other blocks:

events.on('cart/updated', () => {
// React to cart changes
});

Implementation details

Drop-in dependencies

All drop-ins are loaded via import maps defined in head.html:

{
"imports": {
"@dropins/storefront-cart/": "/scripts/__dropins__/storefront-cart/",
"@dropins/storefront-checkout/": "/scripts/__dropins__/storefront-checkout/"
}
}

Provider initialization

Drop-ins require providers to be initialized in scripts/initializers/:

  • GraphQL provider: Configures Commerce backend endpoint and headers
  • Authentication provider: Manages customer sessions and tokens
  • Event provider: Sets up the global event bus

See Configuration for provider setup details.

Styling

Each block includes:

  1. Base styles: Block-specific CSS in blocks/*/block-name.css
  2. Drop-in tokens: Design tokens in scripts/initializers/dropin-name.js
  3. Global tokens: Shared tokens in scripts/initializers/

Blocks by page type

Essential implementations

Every storefront requires these pages:

  • Homepage: Product Recommendations, Product List Page
  • Product Page (PDP): Product Details, Product Recommendations
  • Cart Page: Cart, Product Recommendations
  • Checkout Page: Checkout
  • Account Dashboard: Account Header, Account Sidebar

Common additions

Enhance your storefront with:

  • Wishlist Page: Wishlist
  • Order Tracking: Search Order, Order Status, Orders List
  • Returns Portal: Create Return, Returns List, Order Returns
  • Account Management: Addresses, Customer Information

Performance considerations

Lazy loading

Commerce blocks are lazy-loaded automatically:

  1. Blocks below the fold are loaded when scrolled into view
  2. Drop-in containers are code-split and loaded on demand
  3. Heavy dependencies (like checkout) are loaded only when needed

Critical rendering path

For optimal performance:

  1. Keep Mini Cart in header (loads early)
  2. Defer non-critical blocks below the fold
  3. Use Product Recommendations sparingly (loads ML models)

Development workflow

Local testing

  1. Start the AEM CLI: aem up
  2. Modify block JavaScript in blocks/commerce-*/
  3. Changes hot-reload automatically
  4. Test with demo backend or configure your own in demo-config.json

Adding new blocks

To create a custom commerce block:

  1. Create a new directory: blocks/my-custom-block/
  2. Add decorator: my-custom-block.js
  3. Add styles: my-custom-block.css
  4. Import and render drop-in containers
  5. Initialize required providers

See AEM Custom Blocks documentation for block creation basics.

Need help?

  • Block not rendering? Verify drop-in providers are initialized in scripts/initializers/
  • GraphQL errors? Check Commerce backend configuration in demo-config.json
  • Styling issues? Review design token configuration in drop-in initializers
  • Event not firing? Ensure event bus is initialized and event names match documentation