Architecture Overview
Domain-Driven Design
Both the plugin and theme follow DDD principles with clear layer separation.
Plugin Layers
wp-ecommerce-core/src/
├── Domain/
│ ├── Entities/ # Product, Order, Customer, Invoice, etc.
│ ├── ValueObjects/ # Money, Address, SKU, etc.
│ └── Repositories/ # Repository interfaces
├── Application/
│ └── Services/ # OrderService, StockService, etc.
├── Infrastructure/
│ ├── Persistence/ # MySQL repository implementations
│ └── Gateways/ # Payment, Shipping, myDATA gateways
└── Presentation/
└── Api/ # REST API controllers
Theme Layers
flavor-starter/inc/
├── core/
│ ├── Bootstrap.php # Singleton, DDD boot
│ ├── Container.php # DI container
│ └── helpers.php # 21 infrastructure functions
├── modules/
│ ├── ModuleManager.php
│ └── [module-name]/ # Each module is self-contained
└── translations.php # Translation system
Dependency Injection
Both products use a custom DI container with auto-wiring:
// Register a service
$container->singleton(OrderService::class, function ($c) {
return new OrderService(
$c->make(OrderRepository::class),
$c->make(PaymentGateway::class)
);
});
// Resolve a service
$orderService = $container->make(OrderService::class);
Database Architecture
Plugin Tables ({prefix}ec_*)
| Table | Purpose |
|---|---|
ec_products | Product catalog |
ec_variants | Product variants (size, color) |
ec_orders | Order records |
ec_order_items | Order line items |
ec_customers | Customer data |
ec_options | Plugin configuration |
ec_cache | Plugin cache layer |
ec_invoices | ERP invoices |
ec_stock_movements | Inventory tracking |
ec_journal_entries | Accounting ledger |
Theme Tables ({prefix}flavor_*)
| Table | Purpose |
|---|---|
flavor_options | Theme configuration |
flavor_cache | Theme cache layer |
flavor_translations | UI translations |
Entry Points
Plugin
// wp-ecommerce-core/wp-ec.php (line 1)
// → includes/Bootstrap.php (Singleton init)
// → Container registration
// → Service providers loaded
// → REST API routes registered
Theme
// flavor-starter/functions.php
// → inc/core/Bootstrap.php (Singleton init)
// → Module Manager loads active modules
// → Flavor Options settings registered