beardofedu / beardofedu/agentic-workflows-projects
[CART-002] Cart State: Client-side cart state management
- Dominant language
- CSS
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Overview
Implement client-side cart state management: add items, update quantities, remove items, and persist to `localStorage` so the cart survives a page refresh.
## Acceptance Criteria
- [ ] `addToCart(productId, qty)` adds or increments an item
- [ ] `updateQty(productId, qty)` sets quantity; if qty ≤ 0, removes item
- [ ] `removeFromCart(productId)` removes an item entirely
- [ ] `clearCart()` empties the cart
- [ ] Cart state is persisted in `localStorage` and rehydrated on page load
- [ ] Cart item count in header updates reactively
- [ ] Cart total is computed correctly including discounts (placeholder hook for #13)
## Technical Notes
This should be a standalone module (`cart.js`) that exposes a clean API.
When auth lands (#5), the state module should be ready to sync with the backend cart API (#3).
## Depends On
- #1 — Cart UI must exist before wiring up state
## Blocks
- #3 CART-003 (API integration reads from this state module)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.