Skip to main content

Developer Documentation

Welcome to the developer documentation for the Flavor Starter Theme and WP eCommerce Core Plugin.

Architecture at a Glance

Both products use Domain-Driven Design (DDD) with Dependency Injection:

Domain Layer        → Entities, Value Objects, Repository Interfaces
Application Layer → Services, Business Logic, Use Cases
Infrastructure Layer → Database Repositories, External APIs
Presentation Layer → REST API Controllers, Admin UI

Data Sovereignty Principle

A critical concept: both plugin and theme own ALL their data in custom tables.

// Plugin data — ALWAYS use helpers
wpec_get_option('key'); // NOT get_option('wpec_key')
wpec_set_option('key', 'value'); // NOT update_option('wpec_key')
wpec_cache_get('key'); // NOT get_transient('wpec_key')

// Theme data — ALWAYS use helpers
flavor_get_option('key'); // NOT get_option('flavor_options')
flavor_set_option('key', 'value'); // NOT update_option('flavor_options')
flavor_cache_get('key'); // NOT get_transient('flavor_key')
danger

Never use WordPress get_option() / update_option() for plugin or theme data. Always use the provided helper functions. This is the #1 source of bugs.

Requirements for Development

ToolVersion
PHP8.2+
Node.js16+
Composer2.x
WordPress6.0+

Repository Structure

├── flavor-starter/           # Theme
│ ├── inc/core/ # DDD Bootstrap, Container, Helpers
│ ├── inc/modules/ # Module Manager + modules
│ ├── react-app/ # Vite + React storefront
│ └── templates/ # PHP templates

├── wp-ecommerce-core/ # Plugin
│ ├── src/ # DDD layers (Domain, Application, Infrastructure, Presentation)
│ ├── includes/ # Bootstrap, Container, Helpers
│ ├── admin/ # Admin React app (@wordpress/scripts)
│ └── erp/ # ERP SPA (Vite + React)