How to Make an eCommerce Website
How to Vibe Code a High-Converting eCommerce Storefront
Stay in your creative flow. Direct AI models to build a responsive Product Catalogue, AJAX Slide-Over Cart, Discount Coupon engine, Shipping calculator, and secure Checkout flow in under 25 minutes.
Core Stack
HTML5 / CSS / JS
Persistence
LocalStorage Cart & Orders
AI Partner
Claude / Gemini
Target Time
15โ25 Mins
The Vibe Coding Commerce Philosophy
Setting up a traditional online store often means wrestling with dozens of WooCommerce extensions, monthly app fees, slow database queries, and rigid checkout templates. Vibe coding puts you in control as the Brand Founder & Store Architect: you define the product showcase, promo code math, shipping tiers, and instant slide-out cart while conversational AI generates a lightning-fast storefront in one clean file.
Old-School eCommerce Headaches
- Stacking 20+ paid plugins just to get coupon codes, AJAX cart drawers, and shipping rules.
- Full-page reloads every time a shopper updates item quantities in their cart.
- Complex theme overrides to customize product badges or mobile checkout layout.
- Losing mobile conversions due to multi-second script bloat.
The Vibe Coder Way
- Zero-reload reactive product grid, category filters, and persistent slide-over cart.
- Describe the storefront vibe: "Minimalist Savoy/Minimog-style boutique with coupon code SAVE20, shipping calculator, and customer order history."
- Exact subtotal, discount, tax, and shipping math verified in real time.
- Connect Stripe Payment Links or PayPal buttons when ready to accept live cards.
The 4-Step Blueprint
From an empty folder to a complete online store with catalogue, coupons, shipping, and checkout.
Create Your Storefront File
Open VS Code or Cursor, create a folder named vibe-shop, and add a single file called index.html.
Prompt the Catalogue & Cart Engine
Instruct your AI to build a filterable product catalogue, interactive quantity controls, discount coupon validator, and shipping method selector.
localStorage so shoppers never lose their items on refresh."
Add Coupons, Shipping & Accounts
Layer in promotional discount codes (e.g., WELCOME15), flat-rate vs. express shipping tiers, and a Customer Account drawer showing saved shipping details and order history.
Launch & Connect Payments
Deploy your storefront on Netlify, Vercel, or Cloudflare Pages with automatic SSL security, and link checkout to Stripe Checkout or PayPal.
Vibe Prompt Configurator
Choose your store aesthetic and commerce features. Copy the generated prompt into Claude, Cursor, or Gemini.
Essential Elements of an eCommerce Website
To turn browsers into repeat buyers, every functional and trustworthy eCommerce website needs these six core building blocks:
-
Payment Gateway Integration
Provide seamless, trusted payment optionsโsuch as PayPal, Stripe, Apple Pay, or credit cardsโso shoppers can complete purchases with confidence.
-
Configurable Shipping Methods
Support clear shipping optionsโincluding flat-rate standard delivery, express shipping, and free shipping thresholdsโcalculated transparently before checkout.
-
Product Upload & Catalogue Management
Showcase products with crisp visuals, category tags, SKU/stock indicators, detailed descriptions, and transparent pricing.
-
Customer Accounts & Order History
Let customers save their shipping details and review past order receipts and fulfillment statuses in a dedicated account view.
-
Discount Coupons & Promotions
Boost conversion rates and loyalty with promotional coupon codes for first-time buyers, seasonal sales, and VIP rewards.
-
SSL & Checkout Security Features
Protect customer data with HTTPS/SSL encryption, input validation, and fraud-protected checkout flows that reinforce buyer trust.
The "Golden" Single-File HTML5 eCommerce Store
Save this inside index.html to run a complete eCommerce Website with product filtering, cart management, coupon code (SAVE20), shipping selector, and order history.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SAVOY Studio โ Modern eCommerce Storefront</title>
<style>
:root {
--bg: #0c111d;
--surface: #161f33;
--border: #283655;
--text: #f8fafc;
--muted: #94a3b8;
--accent: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: system-ui, -apple-system, sans-serif;
background: var(--bg); color: var(--text); padding: 22px; line-height: 1.5;
}
.container { max-width: 1180px; margin: 0 auto; display: grid; gap: 20px; }
header {
background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
padding: 16px 22px; display: flex; justify-content: space-between; align-items: center;
}
.layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card, .cart-panel {
background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
}
.price { font-size: 1.25rem; font-weight: 800; color: var(--accent); margin: 6px 0; }
.btn {
background: var(--accent); color: #032217; border: none; padding: 9px 14px;
border-radius: 8px; font-weight: 700; cursor: pointer; width: 100%;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
background: var(--surface); color: var(--muted); border: 1px solid var(--border);
padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.chip.active { background: var(--accent); color: #032217; border-color: var(--accent); }
input, select {
width: 100%; padding: 8px 12px; border-radius: 8px;
border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.cart-row {
display: flex; justify-content: space-between; align-items: center;
padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
</style>
</head>
<body>
<div class="container">
<header>
<div>
<h1 style="font-size:1.35rem;">๐๏ธ SAVOY Minimalist Store</h1>
<small style="color:var(--muted);">๐ SSL Encrypted Checkout โข Promo Code: <strong style="color:var(--accent);">SAVE20</strong> (20% Off)</small>
</div>
<div style="font-weight:700;color:var(--accent);" id="header-cart-badge">Cart (0)</div>
</header>
<div class="layout">
<section>
<div class="chips" id="cat-bar">
<button class="chip active" data-cat="All">All Products</button>
<button class="chip" data-cat="Audio">Audio Gear</button>
<button class="chip" data-cat="Workspace">Workspace</button>
<button class="chip" data-cat="Apparel">Apparel</button>
</div>
<div class="products-grid" id="product-grid"></div>
</section>
<aside class="cart-panel">
<h2 style="font-size:1.15rem;margin-bottom:10px;">๐ Your Shopping Cart</h2>
<div id="cart-items"></div>
<div style="display:grid;gap:10px;margin-top:14px;">
<div style="display:flex;gap:8px;">
<input type="text" id="coupon-input" placeholder="Coupon code (try SAVE20)">
<button class="btn" id="apply-coupon-btn" style="width:auto;">Apply</button>
</div>
<select id="shipping-select">
<option value="0">Standard Ground Shipping (Free)</option>
<option value="15">Express 2-Day Air ($15.00)</option>
</select>
<select id="gateway-select">
<option value="Stripe Card">๐ณ Pay with Stripe (Credit/Debit)</option>
<option value="PayPal Express">๐
ฟ๏ธ Pay with PayPal Express</option>
</select>
<input type="text" id="cust-email" placeholder="Customer Account Email for Order History">
</div>
<div style="margin-top:14px;font-size:0.92rem;display:grid;gap:4px;" id="cart-totals"></div>
<button class="btn" id="checkout-btn" style="margin-top:12px;">๐ Complete Secure Order</button>
<h3 style="font-size:0.95rem;margin:18px 0 8px;color:var(--muted);">๐ฆ Customer Account Order History</h3>
<div id="order-history" style="font-size:0.82rem;color:var(--muted);display:grid;gap:6px;"></div>
</aside>
</div>
</div>
<script>
const products = [
{ id: 1, name: 'Aether Studio Headphones', category: 'Audio', price: 240, desc: 'Lossless wireless acoustic monitors.' },
{ id: 2, name: 'Monolith Aluminum Desk Mat', category: 'Workspace', price: 65, desc: 'Precision anodized slate desk surface.' },
{ id: 3, name: 'Tactile Mechanical Keypad', category: 'Workspace', price: 130, desc: 'Hot-swappable low-profile switches.' },
{ id: 4, name: 'Merino Heavyweight Overshirt', category: 'Apparel', price: 110, desc: 'Breathable all-season studio layer.' }
];
let cart = JSON.parse(localStorage.getItem('vibe_shop_cart')) || [{ id: 1, qty: 1 }];
let orders = JSON.parse(localStorage.getItem('vibe_shop_orders')) || [];
let activeCat = 'All';
let discountRate = 0;
function save() {
localStorage.setItem('vibe_shop_cart', JSON.stringify(cart));
localStorage.setItem('vibe_shop_orders', JSON.stringify(orders));
}
function render() {
const list = activeCat === 'All' ? products : products.filter(p => p.category === activeCat);
document.getElementById('product-grid').innerHTML = list.map(p => `
<article class="card">
<small style="color:var(--accent);font-weight:700;">${p.category}</small>
<h3 style="font-size:1.05rem;margin-top:4px;">${p.name}</h3>
<p style="color:var(--muted);font-size:0.85rem;margin:4px 0;">${p.desc}</p>
<div class="price">$${p.price}</div>
<button class="btn" onclick="addToCart(${p.id})">+ Add to Cart</button>
</article>
`).join('');
let subtotal = 0;
let count = 0;
document.getElementById('cart-items').innerHTML = cart.length ? cart.map(item => {
const p = products.find(x => x.id === item.id);
if (!p) return '';
subtotal += p.price * item.qty;
count += item.qty;
return `
<div class="cart-row">
<span>${p.name} (x${item.qty})</span>
<div style="display:flex;gap:6px;align-items:center;">
<strong>$${p.price * item.qty}</strong>
<button onclick="removeFromCart(${p.id})" style="background:none;border:none;color:#f43f5e;cursor:pointer;">โ</button>
</div>
</div>
`;
}).join('') : '<p style="color:var(--muted);font-size:0.88rem;">Your cart is empty.</p>';
const shipping = cart.length ? Number(document.getElementById('shipping-select').value) : 0;
const discount = Math.round(subtotal * discountRate);
const total = Math.max(0, subtotal - discount + shipping);
document.getElementById('header-cart-badge').textContent = `Cart (${count}) โข $${total}`;
document.getElementById('cart-totals').innerHTML = `
<div>Subtotal: <strong>$${subtotal}</strong></div>
<div style="color:var(--accent);">Coupon Discount: <strong>-$${discount}</strong></div>
<div>Shipping: <strong>$${shipping}</strong></div>
<div style="font-size:1.15rem;margin-top:4px;">Total: <strong style="color:var(--accent);">$${total}</strong></div>
`;
document.getElementById('order-history').innerHTML = orders.length
? orders.slice(0, 4).map(o => `<div>โ
${o.id} โข $${o.total} via ${o.gateway} (${o.email})</div>`).join('')
: '<div>No past orders yet.</div>';
}
window.addToCart = function(id) {
const existing = cart.find(i => i.id === id);
if (existing) existing.qty += 1;
else cart.push({ id, qty: 1 });
save();
render();
};
window.removeFromCart = function(id) {
cart = cart.filter(i => i.id !== id);
save();
render();
};
document.getElementById('apply-coupon-btn').addEventListener('click', () => {
const code = document.getElementById('coupon-input').value.trim().toUpperCase();
discountRate = code === 'SAVE20' ? 0.2 : 0;
render();
});
document.getElementById('shipping-select').addEventListener('change', render);
document.getElementById('checkout-btn').addEventListener('click', () => {
if (!cart.length) return;
const email = document.getElementById('cust-email').value || '[email protected]';
const gateway = document.getElementById('gateway-select').value;
const subtotal = cart.reduce((s, i) => s + (products.find(p => p.id === i.id)?.price || 0) * i.qty, 0);
const shipping = Number(document.getElementById('shipping-select').value);
const total = Math.max(0, subtotal - Math.round(subtotal * discountRate) + shipping);
orders.unshift({ id: 'ORD-' + Math.floor(1000 + Math.random() * 9000), total, gateway, email });
cart = [];
save();
render();
});
document.getElementById('cat-bar').addEventListener('click', e => {
const btn = e.target.closest('[data-cat]');
if (!btn) return;
document.querySelectorAll('#cat-bar .chip').forEach(c => c.classList.remove('active'));
btn.classList.add('active');
activeCat = btn.dataset.cat;
render();
});
render();
</script>
</body>
</html>
How to Debug Without Losing Your Vibe
When cart subtotals, coupon math, or shipping rates drift out of sync, use these three vibe debugging rules:
Integer Cents or Rounded Math
Prevent floating-point decimals like $19.9900000002 by instructing the AI:
"Format all currency values with .toFixed(2) or store prices in integer cents internally."
Zero-Cart Shipping Guard
Ensure an empty cart never shows a $15 shipping charge: "Only add the selected shipping fee when cart.length > 0."
Payment Link Handoff
When moving from prototype to production, ask your AI to map each product ID to a Stripe Payment Link or PayPal Checkout button so you never handle raw card numbers yourself.
The Vibe Prompt Vault
Copy-paste prompts to add Free Shipping unlock bars, product quick-view modals, and multi-currency switchers.
๐ Prompt: Add an Interactive "Free Shipping Threshold" Progress Bar
"Add a dynamic Free Shipping Progress Bar at the top of my eCommerce cart panel that calculates how many dollars away the shopper is from unlocking Free Express Shipping at $200, and automatically waives the shipping fee once subtotal >= $200."
๐ Prompt: Add a Product Quick-View Modal with Variant Swatches
"Add a Quick-View modal when clicking any product card in my online store. Include color/size variant selector pills, SKU badge, verified customer star reviews, and an 'Add Variant to Cart' action."
๐ Prompt: Add International Multi-Currency & Tax Calculation
"Extend my eCommerce storefront header with a Multi-Currency switcher (USD $, EUR โฌ, GBP ยฃ, CAD $) that converts all product prices, coupon discounts, and shipping rates on the fly using Intl.NumberFormat."