Skip to content

Mobile Shopping Bag Screen

Mobile shopping bag screen with quantity steppers, remove and undo, promo code validation, free delivery progress, order summary and a sticky checkout bar.

Also known as: shopping cart app ui, mobile cart page, ecommerce app cart screen, cart with quantity stepper, mobile checkout screen html

Mobile Shopping Bag Screen live demo

Open in new tab

Pure CSS code (HTML, CSS, JS)

A mobile shopping bag screen in pure CSS and vanilla JavaScript: quantity steppers, visible remove buttons, a free delivery progress bar, a promo code field, an order summary and a sticky checkout bar. It is an HTML mobile template for mobile sites and PWAs, and it can be packaged as a native app with Capacitor. Use it as the cart page or checkout screen of a fashion, lifestyle or general ecommerce app.

How it works

The root .sb-app is a phone-width column (max 430px, centred on wide screens). Each product is an li.sb-item with data-sb-price; the .sb-stepper buttons carry data-sb-step="1" or "-1" and change the number in output[data-sb-qty] (1 to 9). After every change update() recalculates all totals and writes them into the summary, the sticky .sb-checkout bar, the title count and the .sb-badge on the Bag tab.

The .sb-remove button removes the row (no swipe needed) and shows the .sb-snack bar with Undo. When the bag is empty, the [data-sb-empty] state replaces the list.

The promo form [data-sb-promo] validates on submit: an empty field or an unknown code sets aria-invalid and shows a red message, a valid code (WELCOME10) adds a discount row. Checkout opens dialog.sb-sheet, a native <dialog> bottom sheet with Standard and Express delivery; the choice updates the totals and Continue to payment shows a success panel.

Customization

  • --sb-accent, --sb-accent-strong and --sb-accent-soft on .sb-app: the coral colour of the progress bar, checkout button, badge and selected delivery card.
  • data-sb-free-over on .sb-app: the free delivery threshold (250); the progress bar and message follow it.
  • data-sb-tax on .sb-app: the tax rate used for the estimate, e.g. 0.2 for 20%.
  • CODES in script.js: valid promo codes and their discount, e.g. { SPRING15: 0.15 }.
  • STANDARD and EXPRESS in script.js: the delivery prices shown in the sheet and summary.
  • The Continue to payment handler in script.js: replace the timeout with your fetch() call to start the real checkout.

Use cases

  • Fashion and apparel shops: review sizes and colours before checkout.
  • Lifestyle and home goods stores: adjust quantities and apply a welcome code.
  • Marketplace PWAs: show a free delivery goal to raise the basket value.
  • Capacitor shopping apps: a native-feeling bag tab with a sticky checkout.

Accessibility

Stepper buttons and remove buttons have descriptive aria-labels, the quantity is an output with aria-live, and the minus button is disabled at 1. After removing an item, focus moves to the next remove button or to Undo. The progress bar uses role="progressbar" with aria-valuenow. The bottom sheet is a modal <dialog>: Escape or the backdrop closes it and focus returns to Checkout. All controls are at least 44px high with a visible focus ring, and the sheet animation is turned off with prefers-reduced-motion.

Usage notes

Product photos come from Unsplash; replace them with your own images. The tab bar links are placeholders for your other screens.

Mobile Shopping Bag Screen at a glance

Framework
Pure CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
fonts.googleapis.com, Bootstrap Icons
Layout
Mobile-first app screen, centred on wider screens
Category
Mobile Shop & Checkout
License
Free for personal and commercial use

Questions about this template

Can I use the Mobile Shopping Bag Screen code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load fonts.googleapis.com and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Can I turn this screen into an iOS or Android app?

Yes. It is plain HTML, CSS and JavaScript, so it works in a mobile website or progressive web app as it is. To ship it as a store app, put it in the web folder of a Capacitor or Cordova project and build it for iOS and Android; replace the sample data with calls to your own API.

How does it look on a desktop screen?

The screen is designed for phones. On wider screens it stays at phone width in the middle of the page, so it still looks like an app. The live demo opens at mobile width; use the Tablet and Desktop buttons to check other sizes.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap">
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Mobile Shopping Bag Screen – Pure CSS mobile shop & checkout component screenshot
Mobile Shopping Bag Screen · Pure CSS Mobile Shop & Checkout

More Mobile Shop & Checkout

Sneaker Store Home with Filters Sheet – Tailwind CSS mobile shop & checkout preview

Sneaker Store Home with Filters Sheet

Sneaker store app home screen with brand chips, search, product cards and a filter bottom sheet with price range, sizes and sort that applies to the product grid.

Coffee Shop Order Customization Screen – Bootstrap 5 mobile shop & checkout preview

Coffee Shop Order Customization Screen

Coffee shop app order screen where customers customize a drink: size cards, milk and syrup options, an extra shot stepper and a live price on the add to order button.

Fashion Store Product Detail Screen – Tailwind CSS mobile shop & checkout preview

Fashion Store Product Detail Screen

Fashion store product detail screen with swipeable photos, colour swatches, size chips with a size guide bottom sheet, details accordion and a sticky Add to bag bar.

Grocery App Product List with Cart Badge – Bootstrap 5 mobile shop & checkout preview

Grocery App Product List with Cart Badge

Grocery app product list screen with filter chips, a two-column product grid with add-to-cart steppers and a floating cart button showing the item count and total.

Order Confirmation and Tracking Screen – Bootstrap 6 mobile shop & checkout preview

Order Confirmation and Tracking Screen

Order confirmation screen for delivery apps with a success illustration, order number, ETA computed from now, live order tracking steps and a help sheet.

Mobile Checkout with Payment Methods – Bootstrap 6 mobile shop & checkout preview

Mobile Checkout with Payment Methods

Mobile checkout screen with a delivery address sheet, delivery time options, payment method radio cards, promo code and a live order summary with place order.