Repository navigation
Conversation
Co-authored-by: Claude <claude@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 849746d. Configure here.
|
|
||
| export function checkoutTotal(cart: Cart): number { | ||
| const subtotal = cartTotal(cart.items); | ||
| const subtotal = cartTotal(cart.items, cart.discount?.percent); |
There was a problem hiding this comment.
Discount applied twice at checkout
High Severity
checkoutTotal now passes the cart's discount into cartTotal, which applies it to the item subtotal, but still applies the same percent again to the final amount. One code therefore compounds, so checkout charges less than the intended discounted price.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 849746d. Configure here.
|
Verdict: Request changes — the discount is applied twice, producing incorrect checkout totals. Correctness (high severity)
Style / clarity (lower severity)
Tests
|


Customers can enter a discount code at checkout.
cartTotalnow applies the code's percent, andcheckoutTotalpasses the cart's code through.Created with Claude Code