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

@@ -44,9 +44,6 @@ final class LicenseEmailController
// Cron action for checking expiring licenses
add_action('wclp_check_expiring_licenses', [$this, 'sendExpirationWarnings']);
// Add email templates location for theme overrides
add_filter('woocommerce_locate_template', [$this, 'locateTemplate'], 10, 3);
}
/**
@@ -61,30 +58,6 @@ final class LicenseEmailController
return $email_classes;
}
/**
* Locate templates in plugin directory
*
* @param string $template Template path
* @param string $template_name Template name
* @param string $template_path Template path prefix
* @return string Modified template path
*/
public function locateTemplate(string $template, string $template_name, string $template_path): string
{
// Only handle our email templates
if (strpos($template_name, 'emails/license-') !== 0) {
return $template;
}
$plugin_template = WC_LICENSED_PRODUCT_PLUGIN_DIR . 'templates/' . $template_name;
if (file_exists($plugin_template)) {
return $plugin_template;
}
return $template;
}
/**
* Schedule the expiration check cron job
*/