# GGM Commerce Plugin - WordPress

A comprehensive e-commerce plugin for WordPress with Elementor integration.

## Repository Information

**GitHub Repository:** https://github.com/Giles-Beckley/elecommerce-wordpress-plugin
**Branch:** main
**Developer:** Giles Beckley

## Features
- Custom product management
- 20+ Elementor widgets with professional styling
- Customer account system with multi-address support
- Order management
- Shopping cart and checkout
- Advanced search, filtering, and pagination
- Modular OOP architecture
- Three-layer styling system (structure + design + Elementor defaults)

## ⚠️ IMPORTANT: Data Architecture

### Source of Truth: Plugin Database Tables

**The plugin's custom database tables are ALWAYS the source of truth for all data.**

This plugin does NOT use WordPress's native:
- Custom Post Types (CPT) for products
- WordPress taxonomies for categories/tags
- WooCommerce tables or structures

All data is stored in custom `wp_ggmc_*` tables:
- `wp_ggmc_products` - Product data
- `wp_ggmc_categories` - Product categories
- `wp_ggmc_product_categories` - Product-category relationships (many-to-many)
- `wp_ggmc_tags` - Product tags
- `wp_ggmc_product_tags` - Product-tag relationships (many-to-many)
- `wp_ggmc_orders` - Orders
- `wp_ggmc_customers` - Customer data
- `wp_ggmc_product_reviews` - Product reviews
- And more...

### Key Implementation Notes:
1. **Product Categories**: Uses `wp_ggmc_product_categories` junction table for many-to-many support (products can have multiple categories)
2. **Product Tags**: Uses `wp_ggmc_product_tags` junction table for many-to-many support (products can have multiple tags)
3. **Never query WordPress posts table** for product data
4. **Always use the taxonomy class methods** (`GGM_Commerce_Taxonomy`) for category/tag operations

## Documentation

### For Developers
- **[Styling Architecture](docs/STYLING-ARCHITECTURE.md)** - Complete guide to the three-layer styling system
- **[Plugin Rules](docs/PLUGIN-RULES.md)** - Quick reference guide (redirects to Styling Architecture)

### Archived Documentation (Reference Only)
- [DEFAULT-STYLING-SYSTEM.md](docs/archive/DEFAULT-STYLING-SYSTEM.md) - Superseded by STYLING-ARCHITECTURE.md
- [PLUGIN-RULES.md (original)](docs/archive/PLUGIN-RULES.md) - Superseded by STYLING-ARCHITECTURE.md

## Version Control
This repository tracks all changes to prevent code loss during development and debugging.

## Installation
1. Upload to `/wp-content/plugins/ggm-commerce/`
2. Activate through WordPress admin
3. Configure settings under GGM Commerce menu
4. Default pages and popup templates created automatically on activation

## Widget Styling System

The plugin uses a unique three-layer approach:

1. **widgets.css** - Structural CSS (always loaded)
2. **professional-defaults.css** - Design CSS (conditionally loaded)
3. **default-widget-styles.php** - Elementor control defaults

Toggle professional defaults via: **GGM Commerce > Settings > Default Styles**

See [STYLING-ARCHITECTURE.md](docs/STYLING-ARCHITECTURE.md) for complete documentation.

## Development Requirements
- PHP 8.1+ compatible
- WordPress 6.0+ required
- Elementor 3.0+ required
- Elementor Pro 3.0+ required (for popup functionality)