R
Redhand
QA
Back to Reports
RPT-003In Progresshighmedium riskbug

Cart total shows NaN when adding second castle

Reported by Igor · Apr 8, 2026, 06:45 PM · Hrady pro děti

Tester Report

Added one castle, price was fine. Added a second one and the total became NaN. Refreshing the page fixes it temporarily.

Details

Page / Module
Cart / Košík
Issue Type
bug
Priority
high
Risk Level
medium
Status
In Progress

AI Analysis

Confidence: 88%

Summary

NaN in cart total caused by string concatenation instead of numeric addition when summing item prices.

Category

Calculation Error

Severity

high

Suspected Area

CartContext reducer — price summation logic

Likely Cause

Price values stored as strings from API/Directus. Addition without parseInt/parseFloat causes "100" + "200" = "100200" then further math = NaN.

Suggested Fix Strategy

1. Add Number() cast in cart reducer
2. Add type guard for price values
3. Unit test cart calculations

Validation Checklist

  • Single item total correct
  • Multiple items total correct
  • Remove item recalculates
  • B2B pricing still works

Developer Prompt

Fix NaN in cart total. Cast prices to Number() in CartContext reducer. Verify B2B pricing path too.

Internal Notes

CartContext price calculation probably not parsing numbers correctly.

Activity

Igor created
Apr 8, 2026, 06:45 PM
System ai analyzed
Apr 8, 2026, 07:00 PM
Richard status changed
in_progress
Apr 9, 2026, 11:00 AM