Update documentation for v0.1.0 release

- README: document rendering bridge architecture, template coverage,
  directory structure, and how the interception pipeline works
- CHANGELOG: comprehensive list of all features added across phases 1-9
- PLAN: update dependencies to reflect completed bridge implementation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 11:20:46 +01:00
parent cb4e57a2e3
commit c432bdc02d
3 changed files with 84 additions and 17 deletions

View File

@@ -8,6 +8,7 @@ A WordPress child theme of [WP Bootstrap](https://src.bundespruefstelle.ch/magde
- PHP 8.3+
- [WP Bootstrap](https://src.bundespruefstelle.ch/magdev/wp-bootstrap) theme (parent)
- [WooCommerce](https://github.com/woocommerce/woocommerce.git) plugin
- Composer
## Installation
@@ -17,33 +18,83 @@ A WordPress child theme of [WP Bootstrap](https://src.bundespruefstelle.ch/magde
4. Run `composer install` in the theme directory
5. Activate the theme in WordPress Admin > Appearance > Themes
## What This Theme Does
## How It Works
The WooCommerce plugin ships with its own Twig templates using custom CSS classes. This child theme overrides those templates to use Bootstrap 5 components, ensuring visual consistency with the WP Bootstrap parent theme.
WooCommerce renders its pages using PHP templates loaded via `wc_get_template()`. This child theme intercepts that process with a **Twig rendering bridge** that replaces the PHP output with Bootstrap 5 styled Twig templates.
The bridge hooks into WooCommerce's `woocommerce_before_template_part` and `woocommerce_after_template_part` actions. When a matching `.html.twig` template exists, it is rendered via the parent theme's TwigService and the original PHP output is discarded. If no Twig override exists, the default PHP template renders normally.
### Key Features
- Bootstrap 5 markup for all plugin templates
- Responsive design inheriting WP Bootstrap's grid system
- Dark mode support via WP Bootstrap's theme toggle
- **99 Twig template overrides** covering all customer-facing WooCommerce pages
- **Rendering bridge** (`WooCommerceExtension` + `TemplateOverride`) that intercepts WooCommerce's PHP template pipeline
- **~50 Twig functions** and **7 Twig filters** exposing WooCommerce and WordPress APIs to templates
- Bootstrap 5 responsive markup with dark mode support
- HPOS compatible (uses `WC_Order` methods only, no `$post` global)
- 8 reusable Twig components (card, pagination, price, rating, address-card, status-badge, quantity-input, form-field)
- Translation-ready
### Template Coverage
| Area | Templates | Status |
| ---- | --------- | ------ |
| Global & Notices | 9 | Done |
| Product Archive & Loop | 15 | Done |
| Single Product | 21 | Done |
| Cart | 9 | Done |
| Checkout | 12 | Done |
| My Account | 15 | Done |
| Order Details | 5 | Done |
| Supplementary (Brands, Auth, Back-in-Stock) | 7 | Done |
| Reusable Components | 8 | Done |
| Emails | -- | Skipped (incompatible pipeline) |
## Development
### Directory Structure
```txt
wc-bootstrap/
├── assets/css/ # Custom CSS overrides
├── assets/js/ # Custom JavaScript
├── inc/ # PHP classes (PSR-4)
├── languages/ # Translation files
├── templates/ # Bootstrap 5 Twig template overrides
├── assets/
├── css/wc-bootstrap.css # Bootstrap override styles
│ └── js/quantity.js # Quantity +/- button handler
├── inc/
├── TemplateOverride.php # WC template interception (before/after hooks)
│ └── Twig/
│ └── WooCommerceExtension.php # WC/WP Twig functions & filters
├── languages/ # Translation files
├── templates/ # Bootstrap 5 Twig template overrides
│ ├── archive-product.html.twig
│ ├── auth/
│ ├── brands/
│ ├── cart/
│ ├── checkout/
│ ├── components/
│ ├── global/
│ ├── loop/
│ ├── myaccount/
│ ├── notices/
│ ├── order/
│ └── single-product/
├── composer.json
├── functions.php
└── style.css
```
### Architecture
```txt
WooCommerce wc_get_template("cart/cart.php")
→ woocommerce_before_template_part hook
→ TemplateOverride checks for cart/cart.html.twig
→ Found → renders via TwigService (with WooCommerceExtension functions)
→ Starts output buffer
→ PHP include (captured in buffer)
→ woocommerce_after_template_part hook
→ TemplateOverride discards buffered PHP output
→ Result: Bootstrap 5 Twig output only
```
### Building Translations
```bash