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
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
| Prop | Type | Description |
|---|---|---|
onAdded? | ((result: LineItemsAddedResult) => void) | After the add, overriding |
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.
| Prop | Type | Description |
|---|---|---|
lines | QuickOrderLine[] | |
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()} />;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} />;
