Skip to content

fix(business): calculate cart total with line item quantities#47

Open
emre155 wants to merge 1 commit into
marandaneto:mainfrom
emre155:fix/cart-total-quantities-issue-26
Open

fix(business): calculate cart total with line item quantities#47
emre155 wants to merge 1 commit into
marandaneto:mainfrom
emre155:fix/cart-total-quantities-issue-26

Conversation

@emre155

@emre155 emre155 commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Fixes the cart total calculation by multiplying each item's price by its quantity (closes #26).

Changes

  • Modified totalCart in src/business.js to evaluate item.price * (item.quantity || 1) in the reduce accumulator.
  • This fixes undercounting where multi-quantity line items were treated as a single item.

All related tests are now passing successfully.

Signed-off-by: emreumar emreumar@users.noreply.github.com

Updates totalCart to multiply each item's price by its quantity (defaulting
to 1 if not defined) when reducing the list, fixing an undercounting bug
where quantities were ignored.

Closes marandaneto#26

Signed-off-by: emreumar <emreumar@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 18, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cart total ignores line item quantities

3 participants