localhost/shop
http://localhost/shop
Develop and test e-commerce shops at localhost/shop before deploying. Test products, checkout, payments, and shipping in a safe local environment.
E-commerce Platforms
| Platform | Type | Best For |
|---|---|---|
| WooCommerce | WordPress Plugin | WordPress sites, small-medium stores |
| Magento | Standalone | Large enterprises, complex catalogs |
| PrestaShop | Standalone | Full-featured stores |
| OpenCart | Standalone | Easy setup, moderate features |
| Shopify Theme Kit | Theme Dev | Shopify theme development |
Setup WooCommerce Locally
- Install WordPress at localhost/shop
- Access WordPress admin
- Install WooCommerce plugin
- Run setup wizard
- Configure store settings
- Add products and categories
- Configure payment gateways (test mode)
- Setup shipping methods
Create Shop Directory
# Windows XAMPP
cd C:\xampp\htdocs
mkdir shop
# Linux
cd /var/www/html
sudo mkdir shop
sudo chown -R www-data:www-data shop
# Mac MAMP
cd /Applications/MAMP/htdocs
mkdir shop
WooCommerce Configuration
// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
// WooCommerce test mode
// In WooCommerce > Settings > Payments
// Enable "Sandbox Mode" for PayPal, Stripe, etc.
// Disable email sending during testing
add_filter('wp_mail', function() { return false; });
Install Magento Locally
# Requirements
# PHP 7.4+, MySQL, Composer, Elasticsearch
# Download Magento
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition shop
cd shop
# Install
php bin/magento setup:install \
--base-url=http://localhost/shop \
--db-host=localhost \
--db-name=magento \
--db-user=root \
--db-password= \
--admin-firstname=Admin \
--admin-lastname=User \
--admin-email=admin@localhost \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago
# Disable two-factor authentication for local dev
php bin/magento module:disable Magento_TwoFactorAuth
Testing E-commerce Features
Product Management
- Add/edit products with variations
- Organize categories and tags
- Upload product images
- Set pricing and discounts
- Manage inventory and stock
Shopping Cart
- Add products to cart
- Update quantities
- Apply coupon codes
- Calculate taxes and shipping
- Test cart abandonment
Checkout Process
- Billing and shipping forms
- Guest vs registered checkout
- Multiple payment methods
- Order review and confirmation
- Order emails (test mode)
Payment Gateway Testing
- Use sandbox/test mode only
- Test credit card processing
- PayPal sandbox transactions
- Stripe test cards
- Verify order status updates
Test Payment Credentials
Stripe Test Cards
# Success
4242 4242 4242 4242
# Decline
4000 0000 0000 0002
# Requires authentication
4000 0025 0000 3155
# Any future expiry date, any 3-digit CVC
PayPal Sandbox
- Create sandbox account at developer.paypal.com
- Generate test business account
- Generate test buyer account
- Use sandbox credentials in WooCommerce
- Test transactions with buyer account
Sample Product Structure
// Simple product
{
"name": "T-Shirt",
"sku": "TS001",
"price": 19.99,
"stock": 100,
"categories": ["Clothing", "Men"]
}
// Variable product
{
"name": "Shoes",
"sku": "SH001",
"variations": [
{"size": "8", "color": "Black", "sku": "SH001-8-BLK", "price": 79.99},
{"size": "9", "color": "Black", "sku": "SH001-9-BLK", "price": 79.99},
{"size": "8", "color": "White", "sku": "SH001-8-WHT", "price": 79.99}
]
}
Database Schema
-- Products table
CREATE TABLE products (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
sku VARCHAR(100) UNIQUE,
description TEXT,
price DECIMAL(10,2),
stock INT,
image VARCHAR(255),
category_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Orders table
CREATE TABLE orders (
id INT PRIMARY KEY AUTO_INCREMENT,
customer_id INT,
total DECIMAL(10,2),
status VARCHAR(50),
payment_method VARCHAR(50),
shipping_address TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Order items table
CREATE TABLE order_items (
id INT PRIMARY KEY AUTO_INCREMENT,
order_id INT,
product_id INT,
quantity INT,
price DECIMAL(10,2)
);
Configure Shipping Methods
// WooCommerce shipping zones
// WooCommerce > Settings > Shipping
// Flat rate
{
"name": "Flat Rate",
"cost": 5.00
}
// Free shipping
{
"name": "Free Shipping",
"min_amount": 50.00
}
// Local pickup
{
"name": "Local Pickup",
"cost": 0.00
}
// Table rate (weight/price based)
// Requires plugin installation
Email Testing
Prevent actual emails during development:
// WordPress: Disable emails
add_filter('wp_mail', '__return_false');
// Or use MailHog for email capture
// Configure SMTP to localhost:1025
// View emails at localhost:8025
// WooCommerce email templates location:
// wp-content/plugins/woocommerce/templates/emails/
Performance Testing
- Test with large product catalogs (1000+ items)
- Simulate multiple concurrent users
- Check page load times
- Monitor database queries
- Test image loading
- Verify caching works
Critical: Always use sandbox/test mode for payment gateways. Never process real payments on localhost. Never store real customer credit card data.
Common Shop Paths
localhost/shop- Store frontlocalhost/shop/products- Product cataloglocalhost/shop/cart- Shopping cartlocalhost/shop/checkout- Checkout pagelocalhost/shop/my-account- Customer accountlocalhost/shop/wp-admin- WooCommerce admin
Development Tip:
Use test data generators to quickly populate your store with products for testing. WooCommerce includes sample products that can be imported.
Frequently Asked Questions
Can I test real payments on localhost?
No, always use sandbox/test mode. Payment processors provide test credentials and test cards that simulate transactions without real money.
How do I import products?
WooCommerce supports CSV import under Products > Import. Most platforms include product import functionality or plugins.
Why are emails not sending?
Localhost typically doesn't have mail server configured. Use email testing tools like MailHog or disable emails during development.
Related Resources
- localhost/wordpress - WordPress setup
- localhost/phpmyadmin - Database management
- localhost/admin - Admin panels
- localhost/api - API development