Refactor email to use WooCommerce transactional email system

- Remove legacy email template files
- Use WooCommerce's email-header.php and email-footer.php templates
- Render email content inline for consistent WooCommerce styling
- Remove template location filter from LicenseEmailController

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-21 21:16:04 +01:00
parent c6726703e4
commit 6378063180
5 changed files with 156 additions and 234 deletions

View File

@@ -36,6 +36,12 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w
_No known bugs at this time._
### Version 0.0.9
**Note for AI Assistants:** Cleanup the versions in this section after implementation, but keep this notice!
## Technical Stack
- **Language:** PHP 8.3.x
@@ -432,20 +438,15 @@ Full API documentation available in `openapi.json` (OpenAPI 3.1 specification).
- Removed "Current Version" field from product license settings
- Current version now automatically derived from latest product version in database
- Refactored email system to use WooCommerce email notification classes
- License Expiration Warning email is now configurable via WooCommerce > Settings > Emails
- Email templates can be overridden in themes (woocommerce/emails/license-expiration.php)
- Refactored email system to use WooCommerce transactional email system
- License Expiration Warning email configurable via WooCommerce > Settings > Emails
- Uses WooCommerce's email header/footer templates for consistent styling
- Configurable warning days for expiration notifications (first and second warning)
**New classes:**
- `LicenseExpirationEmail` - WooCommerce WC_Email subclass for license expiration warnings
**New files:**
- `templates/emails/license-expiration.php` - HTML email template
- `templates/emails/plain/license-expiration.php` - Plain text email template
**Modified classes:**
- `LicensedProduct` - `get_current_version()` and `get_major_version()` now query VersionManager
@@ -456,7 +457,8 @@ Full API documentation available in `openapi.json` (OpenAPI 3.1 specification).
**Technical notes:**
- WooCommerce email system allows admins to customize subject, heading, content, and enable/disable
- Email templates follow WooCommerce conventions and can be overridden in themes
- Email uses WooCommerce's `emails/email-header.php` and `emails/email-footer.php` templates
- Email content is rendered inline, inheriting WooCommerce's styling and customizations
- Admins can customize subject, heading, additional content, and enable/disable via WC settings
- Expiration warning schedule (days before) remains in plugin settings
- Email enable/disable is controlled through WooCommerce email settings