Skip to content

QuickOrder

Order by SKU: the buyer pastes or types SKU and quantity lines, or uploads a CSV export, checks them, and sees each line resolved (name, net price, stock) or rejected with the reason. One action puts every resolved line into the active cart; the lines the cart refuses stay in the table with its reason.

import { QuickOrder } from "@evolve-storefront/feature-cart/quick-order";

Renders inside CartProvider.

Preview

DefaultOpen in Storybook ↗

Usage

Resolved lines go into the cart in one write; the rejected ones stay behind.

// A quick-order page: the lines that can be ordered go to the active cart.
<QuickOrder onAdded={() => router.push("/cart")} />;

Props

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

After the add, overriding CartProvider's onLineItemsAdded and the added sheet: typically route to the cart.

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

Change the layout

Pass children to QuickOrder to arrange its parts yourself. Every part is exported from @evolve-storefront/feature-cart/quick-order.

QuickOrderTableA quick order's lines as a table: SKU, product, quantity, net unit price and line total, and whether it can be ordered — its stock, or why not.
PropTypeDescription
linesQuickOrderLine[]
onRemove?((sku: string) => void)

Omit to hide the remove action.

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

Examples

Refused By The CartA line the cart itself refuses stays in the table with the cart's reason.
// The cart has the last word: a line it refuses stays, with its reason.
<QuickOrder onAdded={({ failed }) => failed.length || goToCart()} />;
Open in Storybook ↗
Add FailsA refusal of the whole add is said under the button, and every line stays.
// A refusal of the whole write renders as an alert; onAdded never runs.
<QuickOrder onAdded={goToCart} />;
Open in Storybook ↗