diff --git a/includes/Core/Notifications/EmailRenderer.php b/includes/Core/Notifications/EmailRenderer.php
index e8383d3..95a5452 100644
--- a/includes/Core/Notifications/EmailRenderer.php
+++ b/includes/Core/Notifications/EmailRenderer.php
@@ -143,10 +143,15 @@ class EmailRenderer {
'store_name' => get_bloginfo('name'),
'store_url' => home_url(),
'site_title' => get_bloginfo('name'),
+ 'support_email' => get_option('admin_email'),
+ 'current_year' => date('Y'),
];
// Order variables
if ($data instanceof \WC_Order) {
+ // Calculate estimated delivery (3-5 business days from now)
+ $estimated_delivery = date('F j', strtotime('+3 days')) . '-' . date('j', strtotime('+5 days'));
+
$variables = array_merge($variables, [
'order_number' => $data->get_order_number(),
'order_id' => $data->get_id(),
@@ -160,6 +165,7 @@ class EmailRenderer {
'order_url' => $data->get_view_order_url(),
'payment_method' => $data->get_payment_method_title(),
'shipping_method' => $data->get_shipping_method(),
+ 'estimated_delivery' => $estimated_delivery,
'customer_name' => $data->get_formatted_billing_full_name(),
'customer_first_name' => $data->get_billing_first_name(),
'customer_last_name' => $data->get_billing_last_name(),
@@ -280,6 +286,9 @@ class EmailRenderer {
$type = $attributes['type'] ?? 'default';
$bg = $attributes['bg'] ?? null;
+ // Parse markdown in content
+ $content = MarkdownParser::parse($content);
+
// Get email customization settings for colors
$email_settings = get_option('woonoow_email_settings', []);
$hero_gradient_start = $email_settings['hero_gradient_start'] ?? '#667eea';
@@ -397,14 +406,22 @@ class EmailRenderer {
$body_bg = '#f8f8f8';
// Email header (logo or text)
- if (!empty($email_settings['logo_url'])) {
+ $logo_url = $email_settings['logo_url'] ?? '';
+
+ // Fallback to site icon if no logo set
+ if (empty($logo_url) && has_site_icon()) {
+ $logo_url = get_site_icon_url(200);
+ }
+
+ if (!empty($logo_url)) {
$header = sprintf(
'',
esc_url($variables['store_url']),
- esc_url($email_settings['logo_url']),
+ esc_url($logo_url),
esc_attr($variables['store_name'])
);
} else {
+ // No logo, use text header
$header_text = !empty($email_settings['header_text']) ? $email_settings['header_text'] : $variables['store_name'];
$header = sprintf(
'%s',
diff --git a/includes/Core/Notifications/MarkdownParser.php b/includes/Core/Notifications/MarkdownParser.php
new file mode 100644
index 0000000..a53e62b
--- /dev/null
+++ b/includes/Core/Notifications/MarkdownParser.php
@@ -0,0 +1,142 @@
+', $html);
+
+ // Parse remaining markdown (outside cards)
+ $html = self::parse_basics($html);
+
+ return $html;
+ }
+
+ /**
+ * Parse basic markdown syntax
+ *
+ * @param string $text
+ * @return string
+ */
+ private static function parse_basics($text) {
+ $html = $text;
+
+ // Headings (must be done in order from h4 to h1 to avoid conflicts)
+ $html = preg_replace('/^#### (.*)$/m', '
' . $line . '
'; + } + + $html = implode("\n", $processed_lines); + + // Clean up extra newlines in HTML + $html = preg_replace('/\n{3,}/', "\n\n", $html); + + return $html; + } + + /** + * Convert newlines to