A modern, interactive online grocery store built with HTML, CSS, and JavaScript. The website features a responsive design, product filtering, search functionality, and a shopping cart system.
- Product Catalog: Browse through a curated selection of fresh groceries
- Category Filtering: Filter products by category (Fruits & Vegetables, Dairy & Eggs, Meat & Poultry, Bakery, Pantry Staples)
- Search Functionality: Quickly find products by name or category in real-time
- Sorting Options: Sort products by name or price (low to high, high to low)
- Quantity Controls: Adjust quantity before adding to cart with intuitive +/- buttons
- Persistent Cart: Cart data is saved in localStorage and persists across sessions
- Real-time Updates: Cart count updates instantly when items are added/removed
- Cart Management: View, edit quantities, and remove items from the cart
- Checkout Page: Secure checkout with order summary and shipping details
- Smooth Animations: Fade-in, slide-in animations for better visual feedback
- Responsive Design: Mobile-friendly layout that works on all devices
- Real-time Feedback: Toast notifications for user actions
- Category Carousel: Auto-rotating product category banners
- Hover Effects: Interactive product cards with elegant hover animations
- Modern UI: Clean, professional design with gradient backgrounds
- Desktop, tablet, and mobile optimized
- Flexible grid layout that adapts to screen size
- Touch-friendly controls for all devices
- Optimized navigation for mobile users
- Simply open
Online Grocery Store.htmlin your web browser - No server setup required!
- The website works completely offline with all features enabled
- All data persists locally in your browser
- Install dependencies:
npm install
- Start the server:
npm start
- Navigate to
http://localhost:3000in your browser
Online Grocery Store/
βββ Online Grocery Store.html # Main homepage
βββ checkout.html # Checkout page
βββ script.js # Main JavaScript (products, cart, filtering, search)
βββ checkout.js # Checkout page logic
βββ products.js # Product database (35 products)
βββ style.css # Modern styling with animations
βββ Images/ # Product images and category banners
βββ package.json # Project metadata
βββ server.js # Node.js backend (optional)
βββ README.md # Documentation
- Welcome section with compelling call-to-action
- Automatically rotating category banners (changes every 3 seconds)
- Quick navigation buttons to all sections
-
Search Bar: Real-time product search by name or category
- Type to search - results update instantly
- Clear to see all products again
-
Category Filter:
- View all categories or filter by specific category
- Instant product updates
-
Sort Options:
- Name (A-Z alphabetical)
- Price: Low to High
- Price: High to Low
-
Interactive Product Cards:
- Product images with lazy loading
- Category badge for quick identification
- Name and price display
- Quantity selector (+/- buttons)
- Add to Cart button with confirmation
- Cart Summary: View all items with quantities and prices
- Item Management: Adjust quantities or remove items
- Real-time Total: Total price updates as you modify cart
- Persistent Data: Cart saved even after closing browser
- Checkout Button: Proceed to purchase flow
- Order Review: See all items in your order
- Shipping Form: Enter delivery and contact information
- Order Confirmation: Confirmation message upon order placement
- Cart Reset: Automatic cleanup after successful order
- Company mission and sustainability commitment
- Information about farmer partnerships
- Employment and community impact details
- Health and nutrition focus
- Simple contact form for inquiries
- Real-time form validation
- Confirmation message upon submission
- HTML5: Semantic, accessible markup
- CSS3: Modern styling with:
- CSS Grid and Flexbox for layout
- Gradient backgrounds
- Smooth animations and transitions
- Media queries for responsiveness
- JavaScript (ES6+):
- Product filtering algorithm
- Cart state management
- localStorage API for persistence
- Event handling and DOM manipulation
- localStorage: For persistent cart storage across sessions
- Express.js: Optional backend (Node.js) for advanced features
| Function | Purpose |
|---|---|
generateProducts() |
Dynamically render product cards with animations |
filterProductsByCategory() |
Filter products by selected category |
searchProducts() |
Real-time search by name or category |
sortProducts() |
Sort products by name or price |
addToCart() |
Add items to shopping cart with quantity |
removeFromCart() |
Remove items from cart |
updateCartCount() |
Update cart counter in header |
updateCartDisplay() |
Refresh cart view with total calculation |
showPage() |
Smooth page navigation and transitions |
changeQty() |
Adjust product quantity before adding |
- fadeIn: Page transitions (0.5s ease-in)
- slideIn: Product cards appear with staggered timing (0.3s)
- slideDown: Header elements appear gracefully (0.4s ease-out)
- pulse: Optional emphasis animation
- Desktop: Full grid layout with 4+ columns
- Tablet (< 1024px): 3-4 column grid
- Mobile (< 768px): Single column, stacked controls
Edit products.js and add objects to the products array:
{
name: 'Product Name',
price: 'Ksh100/unit',
img: 'Images/filename.jpg',
category: 'Category Name'
}Edit color variables in style.css:
- Primary Green:
#4CAF50 - Accent Gold:
#FFD700 - Background Gray:
#f8f9fa - Dark Text:
#333
- Update the category options in HTML filter select
- Update
sortProducts()or add new filter function - Ensure products have matching category names
Edit keyframes in style.css:
- Adjust duration (default 0.3s-0.5s)
- Change easing functions (ease, ease-in, ease-out, linear)
- Modify transform values (translateX, translateY, scale, etc.)
The store includes 35 products across 6 categories:
- Fruits & Vegetables (20 items)
- Dairy & Eggs (5 items)
- Meat & Poultry (4 items)
- Bakery (3 items)
- Pantry Staples (3 items)
Price range: Ksh 10 - Ksh 1500
- β Chrome (latest)
- β Firefox (latest)
- β Safari (latest)
- β Edge (latest)
- β Mobile browsers (iOS Safari, Chrome Mobile)
- Lightweight: No heavy frameworks
- Fast Load Time: < 1 second
- Smooth Animations: 60fps
- Optimized Images: Lazy loading with fallbacks
- Minimal Dependencies: Only Express.js (optional)
- No External Servers: All data stored locally
- localStorage Only: Cart data stays on your device
- No Cookies: Privacy-focused approach
- No Tracking: Your shopping is private
- Touch-friendly buttons (min 44px height)
- Optimized form inputs
- Single column layout on mobile
- Fast, responsive interactions
- Accessible navigation
- β
Ensure
Images/folder exists in same directory - β Check image filenames match exactly (case-sensitive)
- β Verify file permissions
- β Ensure localStorage is enabled in browser
- β Check browser isn't in private/incognito mode
- β Clear cache and try again
- β Update to latest browser version
- β Check browser's hardware acceleration
- β Disable browser extensions that might interfere
- β
Check Node.js is installed:
node --version - β
Run
npm installfirst - β Check port 3000 isn't in use
- User authentication & profiles
- Product reviews and ratings
- Wishlist/favorite items
- Payment gateway integration (M-Pesa, Credit Card)
- Real-time order tracking
- Admin dashboard
- Inventory management
- Email notifications
- Advanced search with filters
- Product recommendations
ISC
Online Grocery Store Development Team
Version: 2.0.0 (Enhanced Interactive Version)
Last Updated: January 2026
Status: β
Fully Functional & Production Ready