Checkout returning — Storefront block
Freestorefront-checkout-returning · for checkout pages
Checkout returning
A signed-in customer with a saved address and card: one card of rows, each editable alone, then one pay button
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/storefront-checkout-returningUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontCheckoutReturning from '@/components/trame/blocks/storefront/storefront-checkout-returning.vue'
const props = {
title: "Complete your order",
intro: "Shipping to the contiguous US, Canada and Mexico.",
lines: [
{
id: 1,
product: {
id: 1,
name: "Lightweight rain jacket",
image: "https://images.unsplash.com/photo-1694561418303-16393986b86d?w=1600&q=80",
alt: "Lightweight rain jacket"
},
unitPrice: 12900,
quantity: 1,
variant: "Forest green · M"
},
{
id: 2,
product: {
id: 2,
name: "24 L backpack",
image: "https://images.unsplash.com/photo-1602845860431-35374f24f48d?w=1600&q=80",
alt: "24 L backpack"
},
unitPrice: 8900,
quantity: 1,
variant: "Sand"
}
],
totals: {
subtotal: 26200,
shipping: null,
tax: 4367,
taxIncluded: true,
total: 26200
},
countries: [
{
code: "US",
name: "United States"
},
{
code: "CA",
name: "Canada"
}
],
shippingOptions: [
{
id: "standard",
name: "Home delivery",
price: 490,
arrival: "Arrives October 14–16",
note: "Package tracking by email"
},
{
id: "express",
name: "Express 24h",
price: 1190,
arrival: "Arrives October 13"
}
],
actions: {
place: "place-order",
back: "cart",
signIn: "sign-in"
},
options: {
guest: true,
simulated: true,
newsletter: "Get new arrivals and offers by email",
payNote: "Your card is charged when your order ships."
}
}
</script>
<template>
<StorefrontCheckoutReturning v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe page’s heading ("Complete the order") |
| intro | string | Wordsone line under the heading, if the merchant has something to say (a delay, a contact) |
| lines* | Line[] | Datathe cart’s lines, as the server prices them |
| totals* | Totals | Datathe cart’s totals from the server: shipping null until a way to ship is chosen |
| countries | Country[] | Datathe countries the shop delivers to; the first is the default |
| shippingOptions | ShippingOption[] | Datathe ways to ship, with price and arrival from the shipping tool |
| onlyShipping | boolean | the shop has one way to ship that serves this order (the first of shippingOptions): shown as a fact, nothing to choose |
| savedAddress | SavedAddress | Datathe signed-in customer’s address, for `returning` |
| savedMethod | SavedMethod | Datathe signed-in customer’s saved payment method (masked by the processor), for `returning` |
| customer | string | Wordswho is signed in ("Camille Martin · [email protected]"), for `returning` |
| actions | Actions | the page actions the block runs, each described below |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Line lines[] · 8 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| product* | Product | the product on the line |
| variant | string | Wordsthe chosen options, written out ("Navy · 42") |
| unitPrice* | number | an amount in cents |
| compareAt | number | an amount in cents |
| quantity* | number | how many, at least 1 |
| maxQuantity | number | the most the line may hold |
| note | string | Wordsa line note: a gift, a delivery delay |
Product lines[].product · 4 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
Totals totals · 11 props
| Prop | Type | Description |
|---|---|---|
| subtotal* | number | an amount in cents |
| discount | number | an amount in cents |
| discountLabel | string | Wordswhat the discount is, e.g. a code’s name |
| shipping | number | null | null: computed at the next step |
| shippingLabel | string | Wordsthe delivery method, e.g. "Standard delivery" |
| fees | number | fees the shop charges on top (service, handling), when it does |
| feesLabel | string | Wordswhat the fees are ("Service fee") |
| tax | number | an amount in cents |
| taxIncluded | boolean | true: the prices include tax |
| total* | number | an amount in cents |
| currency | string | DesignISO 4217, EUR by default |
Country countries[] · 2 props
| Prop | Type | Description |
|---|---|---|
| code* | string | the country’s ISO code, e.g. "FR" |
| name* | string | the country’s name |
ShippingOption shippingOptions[] · 5 props
| Prop | Type | Description |
|---|---|---|
| id* | string | the shipping option’s id |
| name* | string | the shipping option’s name |
| price* | number | its price in cents; 0 when free |
| arrival | string | when it arrives, as the shop writes it |
| note | string | a short note on this delivery option |
SavedAddress savedAddress · 7 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Wordsthe recipient’s name |
| line1* | string | Wordsstreet and number |
| line2 | string | Wordsa second address line: building, floor |
| postalCode* | string | Wordsthe postcode |
| city* | string | Wordsthe town |
| country* | string | Wordsthe country |
| phone | string | Wordsa phone number for the delivery |
SavedMethod savedMethod · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | the saved method’s name, as shown |
| detail | string | a precision on it, e.g. "expires 08/27" |
Actions actions · 5 props
| Prop | Type | Description |
|---|---|---|
| place | string | Actionplaces the order with the form’s values; without act the form posts them to its address |
| quote | string | Actionre-prices the cart when the country or the way to ship changes, through a host that runs actions; posts country and shipping |
| done | string | Actionwhere a placed order leads (its confirmation), with the data the place action answered |
| back | string | Actionthe cart page |
| signIn | string | Actionthe sign-in page |
Options options · 6 props
| Prop | Type | Description |
|---|---|---|
| guest | boolean | say that an account is not needed |
| shipping | boolean | something ships: false hides the address (digital goods); true by default |
| simulated | boolean | payments are a demo: say it plainly |
| newsletter | string | Wordsthe label of an opt-in checkbox (unchecked); no label, no checkbox |
| payNote | string | Wordsone sentence of the merchant’s real payment policy, beside the pay button ("Your card is charged at shipping.") |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| go | navigates after a success |
| can | whether the page has this action |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| cart.fees | Fees | Frais |
| cart.shipping | Shipping | Livraison |
| cart.subtotal | Subtotal | Sous-total |
| cart.total | Total | Total |
| checkout.address1 | Address | Adresse |
| checkout.address2 | Apartment, suite, etc. | Complément d’adresse |
| checkout.backToCart | Back to cart | Retour au panier |
| checkout.bag | Bag | Panier |
| checkout.card | Card | Carte bancaire |
| checkout.checkField | Check this field. | Vérifiez ce champ. |
| checkout.chooseShipping | Choose a shipping method. | Choisissez un mode de livraison. |
| checkout.city | City | Ville |
| checkout.contact | Contact | Contact |
| checkout.continue | Continue | Continuer |
| checkout.continueTo | Continue to {step} | Continuer vers {step} |
| checkout.country | Country | Pays |
| checkout.delivery | Delivery | Livraison |
| checkout.discount | Discount | Réduction |
| checkout.edit | Edit | Modifier |
| checkout.empty | Your cart is empty. | Votre panier est vide. |
| checkout.expressWith | Pay with {method} | Payer avec {method} |
| checkout.free | Free | Gratuite |
| checkout.fullName | Full name | Nom complet |
| checkout.guest | You do not need an account to order. | Pas besoin de compte pour commander. |
| checkout.invalidEmail | Enter a valid email address. | Saisissez une adresse e-mail valide. |
| checkout.item | 1 item | 1 article |
| checkout.items | {count} items | {count} articles |
| checkout.noteSent | To {place} | Vers {place} |
| checkout.notYet | Calculated at the next step | Calculée à l’étape suivante |
| checkout.orCard | or pay by card | ou payer par carte |
| checkout.pay | Pay {amount} | Payer {amount} |
| checkout.payment | Payment | Paiement |
| checkout.phone | Phone | Téléphone |
| checkout.postalCode | Postal code | Code postal |
| checkout.quantity | Quantity | Quantité |
| checkout.required | This field is required. | Ce champ est obligatoire. |
| checkout.save | Save | Enregistrer |
| checkout.shippingMethod | Shipping method | Mode de livraison |
| checkout.signedInAs | Signed in: {who} | Connecté : {who} |
| checkout.signIn | Already a customer? Sign in | Déjà client ? Se connecter |
| checkout.simulated | Demo payment: no card is charged. | Paiement de démonstration : aucune carte n’est débitée. |
| checkout.stepOf | Step {n} of {total} | Étape {n} sur {total} |
| checkout.summary | Order summary | Récapitulatif |
| checkout.tax | Tax | TVA |
| checkout.taxIncl | incl. tax | dont TVA |
| checkout.totalToPay | Total to pay | Total à payer |
| form.email | Email address | Adresse e-mail |
| form.optional | optional | facultatif |
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
checkout.place,checkout.quote,actions.done,actions.back,actions.signIn - Reads
cart,shipping_optionsfrom your app
A storefront section, for checkout pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
More storefront blocks
- Category tiles portrait rail: tall portrait tiles in a scrolling rail with their count and lowest price: a wide catalogue of 6 to 12 rayons.
- Category tiles small material: small square tiles with two lines of facts: materials, fabrics, collections, with or without pictures.
- Checkout extras gift: An optional gift message with the exact changes offered by the merchant.
- Checkout extras note: A full-width delivery note with its character limit, inside the host checkout form.
- Choice guide if then list: a situation, then the option the merchant recommends and why: product selectors and gift guides.
- Choice guide size cards: one card per size or variant with its picture, dimensions and what it holds: choosing a size.
- Clothing rail: the pieces hang sideways on one drawn rail and turn to face the visitor on hover or focus, their neighbours swinging aside; a phone shows one piece at a time: a fashion shop’s new pieces or a short edit, 3 to 12 of the merchant’s own products, best with cut-out pictures of each piece on its own hanger (hanger "none"); a plain photo shot on white melts into a light page. No frame round the pictures.
- Collection banner split: the words on one half and the picture filling the other to the screen’s edge, the sub-categories as a ruled index with their counts: a collection with a tall picture and several sub-categories to jump to.