Skip to content

CartQuickAdd

Add one product to the active cart by article number or name, on one line: the buyer types, picks a suggestion or keeps what they typed as the SKU, sets the quantity and adds. A product the cart refuses says why in place, and the field keeps it; an added one clears the field for the next.

import { CartQuickAdd } from "@evolve-storefront/feature-cart/cart-quick-add";

Renders inside CartProvider.

Preview

DefaultOpen in Storybook ↗

Usage

Typing part of a name offers the product; picking it and adding clears the field.

// On the cart page, where the new line is already in view.
<CartQuickAdd onAdded={() => {}} />;

Props

PropTypeDescription
onAdded?((result: LineItemsAddedResult) => void)

After the add, overriding CartProvider's onLineItemsAdded and the added sheet: on the cart page the new line is already in view.

Any other props go to the root element, like on a plain HTML element.

Examples

RefusedA typed article number is added as is; the cart's refusal says why, in place.
<CartQuickAdd onAdded={() => {}} />;
Open in Storybook ↗