Cart displays accurate item count and subtotal
Why it matters
A cart that displays the wrong item count or a subtotal that double-counts tax erodes purchase confidence at the exact moment it matters most. ISO 25010:2011 functional correctness requires that computed outputs match specifications — a subtotal inflated by tax inclusion makes the cart total contradict the checkout total, producing customer support tickets, chargebacks, and cart abandonment. CWE-20 (Improper Input Validation) also applies when reduction logic operates on unvalidated price data that can produce negative or overflow subtotals.
Severity rationale
Low because incorrect totals are visible to users before payment and do not expose sensitive data, but they erode trust and cause measurable abandonment.
Remediation
Fix the total calculation in src/components/CartSummary.tsx to derive count from quantity sums and subtotal from line item products only — never include tax in the reduce:
// src/components/CartSummary.tsx
const itemCount = items.reduce((sum, item) => sum + item.quantity, 0)
const subtotal = items.reduce((sum, item) => sum + (item.price * item.quantity), 0)
If totals are displayed in more than one location (header badge, drawer, cart page), drive all of them from a single shared selector or context value so a quantity update in one location propagates everywhere without a page reload.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Cart & Checkout UX Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-20 — Improper Input Validation
- iso-25010:2011 · functional-suitability.functional-correctness — Functional Suitability — Functional Correctness
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ecommerce-cart-ux·automated