Skip to main content

Adding to Cart

Your shopping cart holds books you're ready to purchase. Managing your cart is simple and flexible.

Adding Books to Cart

From Book Details

The most common way to add books:

  1. Open book details for any available book
  2. Tap the Add to Cart button (varies by availability)
  3. Book is added to cart
  4. Overlay automatically closes
  5. Confirmation: "Added to cart"

Button Variations:

  • "Buy at [Store Name]" - In-stock at home store
  • "Order Through [Store Name]" - Special order through home store
  • "Order Now" - BookWish Direct (no home store set)

What Gets Added

When you add a book to cart:

Stored Information:

  • Book ID - References the book
  • Quantity - Starts at 1
  • Price at add - Current price when added
  • Store ID - Your home store (if applicable)
  • Item ID - Unique cart item identifier

Cart State Updates

After adding:

  • Cart provider refreshes automatically
  • Navigation bar cart icon updates with item count
  • Cart page shows new item
  • Totals recalculate

Viewing Your Cart

Cart Page

Access your cart:

  • Tap Cart icon in navigation bar
  • Navigate to cart from menu
  • Go directly from checkout prompt

Cart Page Layout:

  • App bar with "Cart" title
  • Scrollable list of items
  • Total summary at bottom
  • Checkout button

Empty Cart

If your cart is empty:

  • "Cart is empty" message displays
  • Gray cart icon
  • No checkout button
  • Prompt to browse books

Cart Items

Each item in your cart shows:

Book Information:

  • Title - Book title in book title typography
  • Price - Price when added (in dollars and cents)
  • Thumbnail - Book cover or placeholder (if available in full implementation)

Actions:

  • Remove button - Trash icon to delete item

Item Layout

Cart items appear as list tiles:

[Book Title]
$XX.XX
[Trash Icon]

Simple, clear presentation focuses on essentials.

Managing Cart Items

Removing Items

To remove a book from your cart:

  1. Find the item in cart list
  2. Tap the trash icon button
  3. Item immediately removed
  4. Cart refreshes
  5. Totals update

What Happens:

  • Item deleted from cart
  • removeItem() method called
  • Cart provider refreshes
  • UI updates automatically

No Confirmation:

  • Items remove immediately
  • No undo option currently
  • Can re-add from book details if needed

Quantity Management

Current Implementation:

  • Quantity set to 1 when adding
  • Can be updated via updateQuantity() method
  • Updates persist in cart state
note

The UI for changing quantities in the cart page may be enhanced in future versions. Currently, quantities are managed through the provider's updateQuantity() method.

Cart Totals

Total Calculation

The cart summary shows:

  • Label: "Total:"
  • Amount: Calculated total in dollars
  • Typography: Heading style, bold for amount

Total Includes:

  • Subtotal (sum of all item prices)
  • Tax (calculated at checkout)
  • Shipping (if applicable)

Displayed Format:

  • Currency symbol ($)
  • Dollars and cents (2 decimal places)
  • Example: "$45.98"

Cart Totals Model

The CartTotals object includes:

  • subtotalCents - Items subtotal
  • taxCents - Calculated tax
  • shippingCents - Shipping cost
  • totalCents - Grand total

All amounts stored as cents (integers) for precision, displayed as dollars.

Cart State Management

Cart Provider

The cart uses Riverpod state management:

Provider: cartNotifierProvider State Type: AsyncValue<CartState>

CartState includes:

  • cart - Cart object with items
  • totals - CartTotals object
  • isCheckingOut - Checkout status flag

Available Methods

Adding Items:

addToCart(String bookId, {int quantity = 1, String? storeId})

Updating Quantity:

updateQuantity(String itemId, int quantity)

Removing Items:

removeItem(String itemId)

Clearing Cart:

clear()

Refreshing:

refresh()

State Updates

Cart automatically refreshes after:

  • Adding items
  • Updating quantities
  • Removing items
  • Completing checkout

Cart Behavior

Persistence

Your cart:

  • Persists across app sessions
  • Stored on server per user
  • Syncs across devices
  • Retrieved on app launch

Cart Limits

No Hard Limits:

  • Add as many items as needed
  • No maximum quantity per item
  • No maximum cart value

Practical Considerations:

  • Performance may degrade with many items
  • Checkout processes each item
  • Inventory checked at checkout time

Checkout

Proceeding to Checkout

When ready to purchase:

  1. Review cart items and total
  2. Tap Checkout button
  3. Navigate to checkout page
  4. Complete checkout process

Requirements to Checkout:

  • At least one item in cart
  • Valid payment method (configured in checkout)
  • Shipping address (for ship orders)

Button State:

  • Enabled when cart has items
  • Shows "Checkout" text
  • Primary button style

See Checkout Process for complete details.

Cart During Checkout

While checking out:

  • Cart state includes isCheckingOut: true
  • Prevents modifications during processing
  • Cart cleared on successful checkout
  • Restored on checkout failure

Loading and Error States

Loading State

While cart loads:

  • Spinner shown in center
  • Circular progress indicator
  • Appears on page load
  • Brief for most users

Error State

If cart fails to load:

  • Error message displayed
  • "Error: [error message]" text
  • Body typography style
  • Centered on page

Common Errors:

  • Network connectivity issues
  • Server errors
  • Authentication problems

Cart Analytics

Cart actions may be tracked:

  • Items added
  • Items removed
  • Checkout initiated
  • Abandoned carts

Used to improve the shopping experience.

Tips for Cart Management

  1. Review before checkout - Double-check items and quantities
  2. Remove unused items - Keep cart clean for faster checkout
  3. Note prices - Prices locked when added; won't change in cart
  4. Check availability - Inventory verified at checkout
  5. Save to wishlist - Use wishlist for "maybe later" items

Common Questions

Q: Does my cart expire? A: No, cart items persist indefinitely until you remove them or complete checkout.

Q: Can I save my cart? A: Your cart is automatically saved and syncs across your devices.

Q: What if a book becomes unavailable? A: You'll be notified at checkout if any items are no longer available.

Q: Can I apply discount codes? A: Discount features may be available during checkout. Check the checkout page for promotional options.

Q: Do prices change after adding to cart? A: No, the price is locked when you add the item (priceAtAddCents).