Site-Wide Shopping Cart: Add Cards from Anywhere
2025-10-05
Site-Wide Shopping Cart: Add Cards from Anywhere
The shopping cart is now site-wide - following you everywhere you browse. Add cards from search results, card detail pages, scanner, or quick search. One cart, everywhere.
What's New
1. Site-Wide Cart Access
The cart is now available on every page:
- Floating button on all pages (not just scan)
- Click to navigate to
/scan
page with full cart - Add cards from anywhere on the site
2. Floating Cart Button
A sticky cart button follows you everywhere, always showing:
- Item count badge (number of cards in cart)
- Running total (estimated cart value)
- One-tap access to scroll to your cart
Why This Matters:
- See your budget in real-time as you shop
- No scrolling needed to check your total
- Tap to jump straight to cart for checkout
Visual:
āāāāāāāāāāāāāāāāāāāā
ā [3] Cart ā
ā $47.50 ā
āāāāāāāāāāāāāāāāāāāā
(Floating at bottom-right)
3. Add to Cart on Card Pages
Every card detail page now has an "š Add to Cart" button:
- Right next to "Shop on TCGplayer"
- One-click add to cart
- Green "ā Added!" feedback
- Continue browsing, cart persists
4. Quick Card Search
Search by name to instantly add cards to cart - no scanning required:
- Type card name ā see results in under 300ms
- Prices displayed for each result
- One-tap add to cart from search results
- Click card image for full details
Perfect for:
- Vendor has card laid out, you know the name
- Adding cards from a want list
- Building cart from memory/notes
- Quick checkout when you're in a hurry
5. Add to Cart Everywhere
You can now add cards from multiple places:
- Card detail pages ā "Add to Cart" button
- Search results ā (coming soon!)
- Quick search ā "Add to Cart" on each result
- Scanner ā "Add to Cart" on scanned cards
All routes lead to the same unified cart.
6. Unified Scan Page
Multiple workflows on the same page:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Quick Card Search ā
ā [Type card name...] ā
ā ā
ā [Search Results with Prices] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
⬠OR ā¬
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Card Scanner ā
ā [š· Camera / š Upload] ā
ā ā
ā [Scanned Results with Prices] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Choose your method:
- Search when you know the name
- Scan when you have the physical card
Real-World Use Cases
1. Minnesota Card Show Shopping
You're at Canterbury Park for the Minnesota Card Show:
Scenario: Walking vendor tables with a budget
- Browse vendor's display cases
- Search card names as you spot interesting cards
- "Rhystic Study" ā $9.99 ā Add to cart
- "Sol Ring" ā $1.50 ā Add to cart
- Floating cart shows: 2 items - $11.49
- Continue shopping across multiple vendors
- Floating cart updates as you add more
- Check out when ready - all cards in one cart
Key Benefits:
- Track spending across multiple vendors
- Don't exceed your budget
- One place to see all your potential purchases
- Easy to remove items if you go over budget
2. Bulk Bin Hunting
You're digging through a vendor's bulk commons/uncommons:
Scenario: Finding hidden gems in chaotic bins
- Pull out interesting cards
- Quick search by name (faster than scanning each)
- Type "Swords to Plowshares" ā $0.50 ā Add
- Type "Lightning Bolt" ā $0.75 ā Add
- Type "Brainstorm" ā $1.00 ā Add
- Floating cart shows: 3 items - $2.25
- Continue digging through bin
- Check cart total before approaching vendor
Key Benefits:
- Speed over scanning for bulk cards
- Build cart while vendor is busy with others
- Have exact total ready for negotiation
- Easy to adjust quantities before checkout
3. Trading Post Browsing
At an LGS with a trading post/display case:
Scenario: Comparing prices on cards you need
- See card in display case
- Search by name to check price
- Store price: $15.00
- Our price: $12.50 (TCGplayer market)
- Decide if store price is fair
- Add to cart if you want to track it
- Show vendor your cart as your want list
Key Benefits:
- Price checking without pulling up TCGplayer
- Build a wishlist to show staff
- Track cards across multiple stores
- Have data ready for trade negotiations
4. Commander Deck Building at the Shop
You're at an LGS brewing a new deck:
Scenario: Building from memory + vendor inventory
- Know your deck list (saved on phone/in head)
- Quick search each card:
- "Commander's Sphere" ā $0.50 ā Add
- "Arcane Signet" ā $1.00 ā Add
- "Sol Ring" ā $1.50 ā Add
- Floating cart tracks total as you build
- Ask vendor if they have specific cards
- Search & add cards they confirm they have
- Check out with complete decklist
Key Benefits:
- Build entire deck list in cart
- See total before committing
- Easy to share cart link with friends
- Can remove cards if over budget
Technical Features
Floating Cart Button
Smart Visibility:
- Only appears when cart has items
- Hides when cart is empty (no clutter)
- Fixed position (always accessible)
- Z-index ensures it's always on top
Display:
- Badge ā item count (e.g., "3")
- Label ā "Cart"
- Total ā estimated value (e.g., "$47.50")
Interaction:
- Click ā smooth scroll to cart sidebar
- Hover ā lift animation + enhanced shadow
- Mobile-friendly ā large touch target
Styling:
Position: Fixed bottom-right (20px from edges)
Background: Blue gradient (#516dff ā #7aa8ff)
Shadow: Glowing blue shadow
Border-radius: Full rounded (pill shape)
Size: Auto-width, comfortable padding
Quick Card Search
Search Performance:
- Debounced input ā waits 300ms after typing stops
- Minimum 2 characters to trigger search
- Max 8 results shown (enough to find card, not overwhelming)
- Parallel pricing fetch ā all cards load together
Search API:
GET /api/cards/search?q={query}&size=8
Returns:
- Card name, set, type line
- Card image (local or Scryfall)
- Pricing data (fetched via /api/cards/versions)
Result Display:
- Grid layout (responsive, 160px min columns)
- Card image at top
- Name + set below
- Price displayed prominently
- "Add to Cart" button at bottom
Add to Cart Flow:
- User clicks "Add to Cart"
- Button changes to "ā Added!" with green background
- Card added with default non-foil finish
- Floating cart updates immediately
- Button returns to normal after 2 seconds
Search + Pricing Integration
Data Flow:
1. User types "Rhystic Study"
ā
2. /api/cards/search?q=Rhystic+Study
ā Returns: basic card info + image
ā
3. For each result: /api/cards/versions?oracle={id}
ā Returns: tcgplayer_id, pricing data
ā
4. Merged data shown in search results
ā Card name, set, image, price, "Add to Cart"
Pricing Sources:
- Primary: TCGcsv nightly cache (fast, offline)
- Fallback: Scryfall bulk data (when TCGcsv missing)
- Format: Structured normal/foil pricing
- Default: Non-foil price shown in search
Mobile Optimization
Responsive Design:
- Floating button: Bottom-right on all screen sizes
- Search grid: Stacks to single column on mobile
- Cart sidebar: Scrolls naturally on small screens
- Touch targets: All buttons 44px+ for easy tapping
Performance:
- Debounced search: Prevents excessive API calls
- Parallel pricing: All cards load simultaneously
- Image lazy loading: Only loads visible results
- Cache-friendly: Search results cached 10 minutes
User Workflows
Workflow 1: Quick Search ā Cart ā Checkout
Steps:
- Open /scan page
- Type card name in search box
- See results with prices
- Click "Add to Cart" for desired cards
- Floating button shows running total
- Repeat for all cards
- Click floating button to scroll to cart
- Review cart, toggle foil if needed
- Click "Buy on TCGplayer" for checkout
Time: ~30 seconds to add 5-10 cards
Workflow 2: Scan + Search Combo
Steps:
- Scan cards you're holding
- Add scanned cards to cart
- Search cards vendor mentions they have
- Add searched cards to cart
- Floating button tracks combined total
- Review mixed cart before checkout
Why This Works:
- Scan for cards in hand
- Search for cards in vendor's case
- One unified cart for everything
Workflow 3: Build Want List at Trade Show
Steps:
- Walk entire show once
- Search & add every card you're interested in
- Floating button shows total cost of want list
- Prioritize which vendors to revisit
- Remove expensive cards to fit budget
- Revisit vendors for final purchases
Key Insight:
- Cart becomes your dynamic shopping list
- Floating total = instant budget check
- Easy to adjust on the fly
Developer Notes
Component Structure
FloatingCartButton.tsx:
- Reads
useScanCart()
context - Shows only when
totalCount > 0
- Accepts
onClick
callback for scroll behavior - Pure presentational component
QuickCardSearch.tsx:
- Manages search state internally
- Debounced API calls (300ms)
- Parallel pricing fetch per result
- Uses
useScanCart()
to add items - Handles navigation to card detail pages
Modified: app/scan/page.tsx:
- Now a
'use client'
component - Renders
<FloatingCartButton>
at top level - Renders
<QuickCardSearch>
above scanner - Adds
data-scan-cart
attribute for scroll target - Handles scroll-to-cart callback
API Dependencies
Required Endpoints:
-
GET /api/cards/search
- Basic card search
- Returns: name, set, image, oracle_id
- Used by QuickCardSearch
-
GET /api/cards/versions
- Pricing data for specific card
- Returns: tcgplayer_id, pricing, tcgcsv
- Used to enrich search results
Both endpoints already exist - no new APIs needed!
State Management
Cart State:
ScanCartContext
handles all cart operationsaddItem()
adds cards from search or scansetFoil()
toggles finish after addingtotalCount
andestimatedTotal
for floating button
Search State:
- Local component state (no global context needed)
query
ā input valueresults
ā search results with pricingisSearching
ā loading statelastAddedId
ā "Added!" feedback state
Performance Considerations
Search Debouncing:
- Prevents API spam during fast typing
- 300ms delay balances responsiveness + efficiency
- Cleans up timeout on unmount
Parallel Pricing:
- All cards fetch pricing simultaneously
- Doesn't block on slow requests
- Handles failures gracefully (card shows without price)
Caching:
- Search API caches results 10 minutes
- Pricing API uses nightly TCGcsv cache
- No unnecessary network calls
Future Enhancements
Short Term
- Voice search ā "Add Rhystic Study" (hands-free at shows)
- Barcode scanner ā scan set codes for quick add
- Recent searches ā quickly re-add common cards
Medium Term
- Want list import ā paste deck list, auto-search all cards
- Vendor notes ā track which vendor had which cards
- Price alerts ā "Sol Ring now $1.00 (was $1.50)"
Long Term
- Multi-vendor carts ā separate carts per vendor
- Show directory ā Minnesota Card Show vendor map
- Trade calculator ā value your trades in cart
Testing Checklist
When testing the new trade show features:
- Floating button appears after adding first item
- Floating button shows correct count
- Floating button shows correct total
- Clicking floating button scrolls to cart
- Floating button hides when cart is empty
- Quick search returns results within 300ms
- Search results show pricing when available
- "Add to Cart" changes to "ā Added!" briefly
- Cards added from search appear in cart
- Cart total updates when adding from search
- Search + scan both add to same cart
- Mobile layout works (button + search responsive)
- Keyboard navigation works in search input
Conclusion
The floating cart button and quick card search transform the scan page into a complete trade show shopping tool:
ā
Always see your budget (floating total)
ā
Add cards instantly (search by name)
ā
No scrolling needed (floating button)
ā
Unified workflow (scan + search ā same cart)
ā
Mobile-friendly (works at shows on phone)
Perfect for:
- Minnesota Card Show (October 5, 2025)
- LGS browsing sessions
- Vendor table shopping
- Bulk bin hunting
- Trade negotiations
This update makes building your cart as fast as finding the cards - exactly what you need when shopping at crowded card shows where speed matters.
Updated: October 5, 2025
Feature shipped for Minnesota Card Show