cart
A basket the user changes in place: a stepper on each line, a subtotal that follows.
A basket that can be changed without typing. cart draws each line with its picture, its price and a stepper, and totals the lines itself as the quantities change.
Drawn live in your browser with the SDK’s own sizes and colours, not a screenshot.
Rendered natively by the Flutter SDK since 0.101.0 and the web SDK since 0.76.0. A build that does not declare it is never offered it.
The card buys nothing. Its button sends the quantities back as a form submission: form_id is this cart_id, and values holds one entry for each line, its id and its quantity. What happens next is your own action, behind its confirm_card.
Prices are numbers (unit_price) with one currency code for the cart, and each device writes the amounts in its own language. The card shows a subtotal only: delivery, tax and discounts are yours to work out, and note is the line that says so.
When not to use it
A basket or an order that is only read is a receipt. One number to ask for is a form field of kind stepper.
Props
Every block also carries type and a required fallback_text of 1 to 300 characters.
| Prop | Type | Required | Constraints |
|---|---|---|---|
cart_id | string | Yes | 1 to 64 characters. |
title | string | No | Up to 80 characters. |
lines | array | Yes | 1 to 12 entries. |
lines[].id | string | Yes | 1 to 64 characters. |
lines[].title | string | Yes | 1 to 80 characters. |
lines[].detail | string | No | Up to 80 characters. |
lines[].image_url | string | No | None |
lines[].unit_price | number | Yes | 0 to 1,000,000,000. |
lines[].quantity | integer | Yes | 0 to 99. |
lines[].max | integer | No | 1 to 99. |
currency | string | Yes | Matches ^[A-Z]{3}$. |
note | string | No | Up to 120 characters. |
submit_label | string | Yes | 1 to 30 characters. |
On the wire
{
"id": "blk_93",
"type": "cart",
"fallback_text": "Your cart: Aero Glide 2 and two packs of running socks, $165 before delivery.",
"props": {
"cart_id": "cart",
"title": "Your cart",
"lines": [
{ "id": "aero-glide-2-43", "title": "Aero Glide 2", "detail": "Size 43 · Volt", "unit_price": 129, "quantity": 1 },
{ "id": "socks-3-m", "title": "Running socks", "detail": "3 pairs · M", "unit_price": 18, "quantity": 2, "max": 6 }
],
"currency": "USD",
"note": "Delivery is free over $80.",
"submit_label": "Review order"
}
}Interaction
Each stepper moves its line between 0 and max (99 when absent). A line at 0 stays on the card, struck through, until the button is pressed, so a slip is one tap to undo. The button carries the subtotal beside submit_label; once pressed, the card locks. If the answer does not arrive, the card says so and the button can be pressed again.