Variant prices override base price when applicable
Why it matters
When a variant has a custom price but the display and cart always use the base product price, customers see one price on the listing and are charged a different amount at checkout — or variants intended to cost more (e.g., XL size surcharge) are sold at the base price, creating a revenue shortfall on every sale of that variant. ISO 25010:2011 functional-correctness requires that price-affecting selections are reflected consistently across all display and calculation contexts. A product page showing $29.99 and a cart showing $24.99 erodes trust even when the error favors the customer.
Severity rationale
High because ignoring variant prices causes customers to be charged the wrong amount, producing either customer complaints when overcharged or silent revenue loss when undercharged.
Remediation
Centralize variant price resolution in src/lib/pricing.ts so all display components and cart calculations use a single source of truth.
export const resolvePrice = (
product: { price: Decimal },
variant?: { price?: Decimal | null } | null
): Decimal => {
if (variant?.price != null) return variant.price
return product.price
}
Import resolvePrice in src/components/product/ProductCard.tsx, src/app/products/[slug]/page.tsx, and src/components/cart/CartItem.tsx. Do not inline the fallback logic in each component — divergence between components is how this bug reappears.
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 Catalog & Product Logic Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · functional-correctness — Functional Correctness (Functional Suitability)
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ecommerce-catalog·automated