StealThis .dev
Pages Hard

Shop — Checkout

A trustworthy multi-step storefront checkout that walks shoppers from contact to shipping, payment, and a final review with a progress indicator and per-step validation. It auto-formats card number, expiry, CVC, phone, and ZIP, offers priced shipping methods with delivery estimates, applies a promo code, and keeps a live order-summary sidebar in sync before a simulated place-order success state with order number and arrival date.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Checkout

A four-step checkout (Contact → Shipping → Payment → Review) wrapped in a numbered progress indicator that fills in as each step is validated. Every step gates the next: email and phone are format-checked, the address form requires name, street, city, state, and a 5-digit ZIP, and the payment step runs a Luhn check on the card number plus a future-dated expiry. Errors surface inline with aria-live messages and the first invalid field takes focus.

The payment step renders a live gradient card preview that mirrors the typed name, formatted number, detected brand (Visa, Mastercard, Amex, Discover), and expiry. Shipping methods are priced radios with delivery ETAs, and a persistent order-summary sidebar recomputes subtotal, discount, shipping, tax, and total on every change. A TRAIL10 promo code applies a 10% discount, and the final review groups everything with quick Edit jumps before a simulated place-order spinner resolves into a success dialog showing the order number, total, and estimated arrival date.

On small screens the sidebar collapses into a tappable total bar, the step labels and grids stack, and all controls stay keyboard-usable with visible focus rings.

Illustrative storefront UI only — fictional products, prices, and reviews. No real checkout.