Skip to main content
The createProductCard() controller manages the state needed to render an interactive product card. It keeps variant selection, option availability, media, and prices together while you render the current state.

Create a controller

createProductCard({ product, selectedOptions?, breakoutOptions? }) returns a ProductCardController. selectedOptions defaults to product.selectedOptions; pass [] to opt out. breakoutOptions defaults to product.breakoutOptions.

Controller surface

state is a plain object, not a signal. Read it synchronously or subscribe to updates.

State types

Vanilla JavaScript example

Subscribe to the controller to render option buttons and the selected price. Disable options whose status is unavailable. Call the unsubscribe function and dispose() when the card is removed.
For a React integration, see ProductCard integration.

Next steps