This document describes the shopping cart functionality that has been implemented for the Undetectable fashion app.
- Global state management for cart items
- Support for both regular products and custom designs
- Persistent storage using localStorage
- Cart operations: add, remove, update quantity, clear
- Displays cart icon with item count badge
- Toggles cart drawer visibility
- Integrated into dashboard navigation
- Slide-out cart panel
- Displays cart items with design previews
- Quantity controls and item removal
- Proceed to checkout functionality
- Modal for ordering custom designs
- Size and color selection
- Quantity selection
- Dynamic pricing based on design type and test results
- Order summary display
- Payment processing simulation
- Order completion confirmation
- Stripe integration ready
- Order buttons on saved designs now functional
- Cart button in navigation
- Order modal integration
- Order button now opens order modal
- Current design can be ordered directly
- From Dashboard: Click "Order" button on any saved design
- From Design Page: Click "Order" button while designing
- Select size, color, and quantity in the order modal
- Click "Add to Cart"
- Click the cart button in the navigation
- View all items in the cart drawer
- Adjust quantities or remove items
- Click "Proceed to Checkout" to go to checkout page
- Review order summary
- Click "Pay" button to simulate payment
- Receive order confirmation
The app is set up for Stripe integration:
-
Configuration:
src/lib/stripe.tscontains Stripe setup -
Environment Variables: Add your Stripe keys to
.env.local:NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_key_here -
Checkout: The checkout page is ready for Stripe Checkout integration
interface CartItem {
productId: string;
product: Product;
quantity: number;
selectedSize: string;
selectedColor: string;
}interface CustomDesignCartItem {
id: string;
design: SavedDesign;
quantity: number;
selectedSize: string;
selectedColor: string;
price: number;
}Custom designs are priced based on:
- Base Price: $29.99 for shirts, $59.99 for hoodies
- Privacy Multiplier: 1.2x for tested & ready designs, 1.0x for untested
- Final Price: Base Price × Privacy Multiplier
- Real Stripe Integration: Replace simulation with actual Stripe Checkout
- Order History: Track completed orders
- User Accounts: Associate orders with user accounts
- Inventory Management: Track stock levels
- Shipping Options: Add shipping cost calculation
- Discount Codes: Support for promotional codes
- Email Notifications: Send order confirmations
To test the shopping cart:
- Create some designs in the design page
- Save them to see them in the dashboard
- Click "Order" on any design
- Add items to cart
- View cart and proceed to checkout
- Complete the checkout process