Accessing the Cart
The shopping cart is accessible from any page in the application through a drawer interface that slides in from the side.Opening the Cart
- Click the cart icon in the header (displays the number of items)
- The cart drawer opens from the side of the screen
- The cart remains accessible while browsing products
Closing the Cart
- Click the ✕ close button in the cart header
- Click outside the cart drawer area
The cart icon in the header shows the total number of unique items (not the total quantity) currently in your cart.
Cart Interface
The cart drawer displays:- Cart Header: “Carrito de Compras” title with close button
- Cart Items: List of all products added to your cart
- Total Price: Running total of all items
- Action Buttons: Options to empty cart or complete purchase
Empty Cart State
When your cart is empty, you’ll see the message:Adding Items to Cart
There are multiple ways to add products to your shopping cart:From Product Gallery
- Browse the product catalog
- Click the “Agregar” button on any product card
- The item is added with a quantity of 1
- A success toast notification appears:
"[Product Name]" agregado al carrito
Adding Duplicate Items
If you add an item that’s already in your cart:- The existing item’s quantity increases by 1
- An info toast appears:
Cantidad aumentada para "[Product Name]" - The item is NOT duplicated in the cart list
Implementation Reference
Managing Cart Items
Each item in your cart displays:- Product Name: The name of the item
- Unit Price: Price per individual item (e.g., $45.99 c/u)
- Quantity Controls: Buttons to increase/decrease quantity
- Current Quantity: Number displayed between - and + buttons
- Remove Button: Trash icon to delete the item entirely
Cart Item Display
Adjusting Quantities
Increasing Quantity
- Click the + button next to any item
- The quantity increases by 1
- The total price updates automatically
Decreasing Quantity
- Click the - button next to any item
- If quantity > 1: The quantity decreases by 1
- If quantity = 1: The item remains (use trash icon to remove)
Removing Items
To completely remove an item from your cart:- Click the trash icon (🗑️) next to the item
- The item is immediately removed from the cart
- The total price updates automatically
Cart Total
The cart displays a running total at the bottom:- Each item’s price × quantity is summed
- Formatted to 2 decimal places
- Updates in real-time as you modify the cart
Cart Actions
Emptying the Cart
- Click the “Vaciar Carrito” button
- All items are removed immediately
- The cart returns to empty state
Completing Your Purchase
- Review all items in your cart
- Verify quantities and total price
- Click the “Finalizar Compra” button (green)
- A confirmation dialog appears with your order summary
Purchase Confirmation Dialog
The confirmation shows:- Order Summary: List of all items with quantities and subtotals
- Individual Line Items:
[Product Name] - [Qty] x $[Price] = $[Subtotal] - Total Price: Bold display of the final amount
- Action Buttons:
- Aceptar: Confirm and complete the purchase
- Cancelar: Return to cart without purchasing
The confirmation dialog is scrollable if you have many items, so you can review your entire order before confirming.
After Purchase Confirmation
When you click “Aceptar”:- Your cart is automatically emptied
- A success message appears: “¡La compra se ha realizado con éxito!”
- You can continue shopping with a fresh cart
Empty Cart Purchase Prevention
If you try to finalize purchase with an empty cart:- An info alert appears: “No hay productos para comprar.”
- The purchase process does not proceed
Cart Persistence
Currently, the cart is stored in memory:- Cart contents are maintained while browsing the site
- Cart is cleared when you refresh the page
- Cart is cleared after completing a purchase
The cart data is managed through React Context (CartContext) and is not persisted to localStorage or a database.
Best Practices
Review Before Checkout
Always review your cart contents and total before clicking “Finalizar Compra” to ensure everything is correct.
Use Quantity Controls
Adjust quantities using the +/- buttons rather than removing and re-adding items.
Check Stock
Verify product stock levels in the gallery before adding large quantities to your cart.
Cart Icon Badge
Keep an eye on the cart icon badge in the header to track how many unique items you’ve added.
Related Features
- Browsing Products - Find items to add to your cart
- Product Details - Learn more about products before purchasing
- Contact - Get help with your order