diff --git a/includes/Core/Notifications/EmailRenderer.php b/includes/Core/Notifications/EmailRenderer.php index 1f31707..bc16478 100644 --- a/includes/Core/Notifications/EmailRenderer.php +++ b/includes/Core/Notifications/EmailRenderer.php @@ -349,8 +349,8 @@ class EmailRenderer { if ($type !== 'default') { $class .= ' card-' . esc_attr($type); - // Apply gradient and text color for hero/success cards - if ($type === 'hero' || $type === 'success') { + // Apply gradient and text color for hero cards + if ($type === 'hero') { $style .= sprintf( ' background: linear-gradient(135deg, %s 0%%, %s 100%%);', esc_attr($hero_gradient_start), @@ -365,6 +365,18 @@ class EmailRenderer { $content ); } + // Success card - green theme + elseif ($type === 'success') { + $style .= ' background-color: #f0fdf4; border-left: 4px solid #22c55e;'; + } + // Info card - blue theme + elseif ($type === 'info') { + $style .= ' background-color: #f0f7ff; border-left: 4px solid #0071e3;'; + } + // Warning card - orange theme + elseif ($type === 'warning') { + $style .= ' background-color: #fff8e1; border-left: 4px solid #ff9800;'; + } } // Add background image diff --git a/includes/Email/DefaultTemplates.php b/includes/Email/DefaultTemplates.php index 03fc76e..27466c1 100644 --- a/includes/Email/DefaultTemplates.php +++ b/includes/Email/DefaultTemplates.php @@ -5,16 +5,61 @@ * Complete collection of ready-to-use email templates for online stores. * These templates follow modern, minimal design principles and work perfectly * without any customization required by store owners. - * - * Card Syntax: - * - [card] Default card with white background - * - [card type="success"] Green-themed card for positive messages - * - [card type="info"] Blue-themed card for information - * - [card type="warning"] Orange-themed card for warnings - * - [card type="hero"] Large header card with gradient background - * + * + * Available Variables by Event: + * + * ORDER EVENTS (order_placed, order_confirmed, order_shipped, order_completed, order_cancelled): + * - {customer_name} - Customer's full name + * - {order_number} - Order number/ID + * - {order_date} - Order creation date + * - {order_total} - Total order amount + * - {order_url} - Link to view order details + * - {order_items} - List of ordered items + * - {payment_method} - Payment method used + * - {shipping_address} - Full shipping address + * - {billing_address} - Full billing address + * - {tracking_number} - Shipping tracking number (if available) + * - {tracking_url} - Tracking URL (if available) + * + * PAYMENT EVENTS (payment_received, payment_failed): + * - All order variables above, plus: + * - {payment_status} - Current payment status + * - {payment_date} - Payment date/time + * - {transaction_id} - Payment transaction ID + * + * CUSTOMER EVENTS (customer_registered, customer_vip_upgraded): + * - {customer_name} - Customer's full name + * - {customer_email} - Customer's email + * - {account_url} - Link to customer account + * - {vip_benefits} - List of VIP benefits (for vip_upgraded) + * + * COMMON VARIABLES (available in all templates): + * - {site_name} - Store name + * - {site_url} - Store URL + * - {support_email} - Support email address + * - {current_year} - Current year (for copyright) + * + * Card Syntax Examples: + * + * [card] + *
Default card with white background
+ * [/card] + * + * [card type="success"] + *Green-themed card for positive messages
+ * [/card] + * + * [card type="hero"] + *Large header card with gradient background
+ * [/card] + * * Button Syntax: - * [button url="{placeholder}"]Button Text[/button] + * + * + * * * @package WooNooW * @subpackage Email @@ -22,1009 +67,1083 @@ namespace WooNooW\Email; -class DefaultTemplates { +class DefaultTemplates +{ + /** + * Get all default templates organized by recipient and event + * + * @return array Associative array of templates + */ + public static function get_all_templates() + { + $templates = [ + 'customer' => [ + 'order_placed' => self::customer_order_placed(), + 'order_pending' => self::customer_order_pending(), + 'order_on_hold' => self::customer_order_on_hold(), + 'payment_received' => self::customer_payment_received(), + 'payment_failed' => self::customer_payment_failed(), + 'order_processing' => self::customer_order_processing(), + 'order_shipped' => self::customer_order_shipped(), + 'order_completed' => self::customer_order_completed(), + 'order_failed' => self::customer_order_failed(), + 'order_cancelled' => self::customer_order_cancelled(), + 'order_refunded' => self::customer_order_refunded(), + 'new_customer' => self::customer_new_customer(), + ], + 'staff' => [ + 'order_placed' => self::staff_order_placed(), + 'order_pending' => self::staff_order_pending(), + 'order_on_hold' => self::staff_order_on_hold(), + 'payment_received' => self::staff_payment_received(), + 'payment_failed' => self::staff_payment_failed(), + 'order_processing' => self::staff_order_processing(), + 'order_shipped' => self::staff_order_shipped(), + 'order_completed' => self::staff_order_completed(), + 'order_failed' => self::staff_order_failed(), + 'order_cancelled' => self::staff_order_cancelled(), + 'order_refunded' => self::staff_order_refunded(), + ], + ]; - /** - * Get all default templates organized by recipient and event - * - * @return array Associative array of templates - */ - public static function get_all_templates() { - $templates = [ - 'customer' => [ - 'order_placed' => self::customer_order_placed(), - 'order_processing' => self::customer_order_processing(), - 'order_shipped' => self::customer_order_shipped(), - 'order_completed' => self::customer_order_completed(), - 'order_cancelled' => self::customer_order_cancelled(), - 'order_on_hold' => self::customer_order_on_hold(), - 'order_failed' => self::customer_order_failed(), - 'order_refunded' => self::customer_order_refunded(), - 'order_pending' => self::customer_order_pending(), - 'payment_received' => self::customer_payment_received(), - 'payment_failed' => self::customer_payment_failed(), - 'new_customer' => self::customer_new_customer(), - ], - 'staff' => [ - 'order_placed' => self::staff_order_placed(), - 'order_processing' => self::staff_order_processing(), - 'order_shipped' => self::staff_order_shipped(), - 'order_completed' => self::staff_order_completed(), - 'order_cancelled' => self::staff_order_cancelled(), - 'order_on_hold' => self::staff_order_on_hold(), - 'order_failed' => self::staff_order_failed(), - 'order_refunded' => self::staff_order_refunded(), - 'order_pending' => self::staff_order_pending(), - 'payment_received' => self::staff_payment_received(), - 'payment_failed' => self::staff_payment_failed(), - ], - ]; - - /** - * Filter: woonoow_email_default_templates - * - * Allows plugins to add or modify default email templates - * - * @param array $templates Templates organized by recipient type and event - */ - return apply_filters('woonoow_email_default_templates', $templates); - } + /** + * Filter: woonoow_email_default_templates + * + * Allows plugins to add or modify default email templates + * + * @param array $templates Templates organized by recipient type and event + */ + return apply_filters('woonoow_email_default_templates', $templates); + } - /** - * Get default subject for a specific template - * - * @param string $recipient 'customer' or 'staff' - * @param string $event Event type - * @return string Default subject line - */ - public static function get_default_subject($recipient, $event) { - $subjects = [ - 'customer' => [ - 'order_placed' => 'Your order #{order_number} has been received', - 'order_processing' => 'Your order #{order_number} is being processed', - 'order_shipped' => 'Your order #{order_number} is on its way', - 'order_completed' => 'Your order #{order_number} has arrived', - 'order_cancelled' => 'Your order #{order_number} has been cancelled', - 'order_on_hold' => 'Your order #{order_number} is on hold', - 'order_failed' => 'Your order #{order_number} has failed', - 'order_refunded' => 'Your order #{order_number} has been refunded', - 'order_pending' => 'Your order #{order_number} is pending', - 'payment_received' => 'Payment confirmed for order #{order_number}', - 'payment_failed' => 'Payment failed for order #{order_number}', - 'new_customer' => 'Welcome to {site_name}!', - ], - 'staff' => [ - 'order_placed' => '[New Order] #{order_number} from {customer_name}', - 'order_processing' => '[Order Processing] #{order_number}', - 'order_shipped' => '[Order Shipped] #{order_number}', - 'order_completed' => '[Order Completed] #{order_number}', - 'order_cancelled' => '[Order Cancelled] #{order_number}', - 'order_on_hold' => '[Order On-Hold] #{order_number}', - 'order_failed' => '[Order Failed] #{order_number}', - 'order_refunded' => '[Order Refunded] #{order_number}', - 'order_pending' => '[Order Pending] #{order_number}', - 'payment_received' => '[Payment Received] #{order_number} - {order_total}', - 'payment_failed' => '[Payment Failed] #{order_number}', - ], - ]; + /** + * Get default subject for a specific template + * + * @param string $recipient 'customer' or 'staff' + * @param string $event Event type + * @return string Default subject line + */ + public static function get_default_subject($recipient, $event) + { + $subjects = [ + 'customer' => [ + 'order_placed' => 'Order confirmed: #{order_number} ๐ฆ', + 'order_pending' => 'We\'re processing your order #{order_number}', + 'order_on_hold' => 'Action needed: Complete payment for #{order_number}', + 'payment_received' => 'โ Payment received for order #{order_number}', + 'payment_failed' => 'Payment didn\'t go through - Help needed for #{order_number}', + 'order_processing' => 'Great news! Your order #{order_number} is being prepared ๐', + 'order_shipped' => 'Your package is on its way! ๐ฎ Order #{order_number}', + 'order_completed' => 'Your order #{order_number} has arrived - We\'d love your feedback!', + 'order_failed' => 'Issue with order #{order_number} - We\'re here to help', + 'order_cancelled' => 'Order #{order_number} has been cancelled', + 'order_refunded' => 'Refund processed for order #{order_number}', + 'new_customer' => 'Welcome to {site_name}! ๐ Exclusive offer inside', + ], + 'staff' => [ + 'order_placed' => '[NEW ORDER] #{order_number} - ${order_total} from {customer_name}', + 'order_pending' => '[PENDING] #{order_number} - Awaiting payment confirmation', + 'order_on_hold' => '[ON HOLD] #{order_number} - {customer_name} needs to complete payment', + 'payment_received' => '[PAYMENT RECEIVED] #{order_number} - ${order_total} - Ready to process', + 'payment_failed' => '[PAYMENT FAILED] #{order_number} - {customer_name} - Action required', + 'order_processing' => '[READY TO SHIP] #{order_number} - Begin fulfillment', + 'order_shipped' => '[SHIPPED] #{order_number} - Tracking: {tracking_number}', + 'order_completed' => '[COMPLETED] #{order_number} - Customer received delivery', + 'order_failed' => '[FAILED] #{order_number} - Unable to process', + 'order_cancelled' => '[CANCELLED] #{order_number} - Refund may be required', + 'order_refunded' => '[REFUNDED] #{order_number} - ${order_total} refunded to customer', + ], + ]; - $subject = $subjects[$recipient][$event] ?? ''; - - /** - * Filter: woonoow_email_default_subject - * - * Allows plugins to modify default email subjects - * - * @param string $subject Default subject line - * @param string $recipient Recipient type ('customer' or 'staff') - * @param string $event Event ID - */ - return apply_filters('woonoow_email_default_subject', $subject, $recipient, $event); - } + $subject = $subjects[$recipient][$event] ?? ''; - // ======================================================================== - // CUSTOMER TEMPLATES - // ======================================================================== + /** + * Filter: woonoow_email_default_subject + * + * Allows plugins to modify default email subjects + * + * @param string $subject Default subject line + * @param string $recipient Recipient type ('customer' or 'staff') + * @param string $event Event ID + */ + return apply_filters('woonoow_email_default_subject', $subject, $recipient, $event); + } - /** - * Customer: Order Placed - * Sent immediately when customer places an order - */ - private static function customer_order_placed() { - return '[card type="hero"] + // ======================================================================== + // CUSTOMER TEMPLATES + // ======================================================================== -## Thank you for your order, {customer_name}! + /** + * Customer: New Customer + * Sent when customer creates an account + */ + private static function customer_new_customer() + { + return '[card type="hero"] +## Welcome to {site_name}, {customer_name}! ๐ -We\'ve received your order and will begin processing it right away. +Your account is ready. Here\'s what you can do now: [/card] [card] +**Your Account Benefits:** +โ Track orders in real-time with live updates +โ Save your favorite items for later +โ Faster checkout on future purchases +โ Exclusive member deals and early access +โ Easy returns and refunds +[/card] -**Order Number:** #{order_number} -**Order Date:** {order_date} -**Order Total:** {order_total} +[button url="{my_account_url}"]Access Your Account[/button] +[button url="{shop_url}"]Start Shopping[/button] +[card type="info"] +๐ก **Tip:** Check your account settings to receive personalized recommendations based on your interests. +[/card] + +[card type="basic"] +Got questions? Our customer service team is ready to help: {support_email} +[/card]'; + } + + /** + * Customer: Order Placed + * Sent immediately when customer places an order + */ + private static function customer_order_placed() + { + return '[card type="hero"] +## Thank you for your order, {customer_name}! ๐ + +We\'ve received your order and it\'s now in our system. We\'re working on it right now! [/card] [card] +**Order Details:** +Order Number: #{order_number} +Order Date: {order_date} +Order Total: {order_total} +[/card] +[card] +**What You Ordered:** {order_items_table} - [/card] [card] +**Shipping Address:** +{shipping_address} **Payment Method:** {payment_method} -**Status:** Processing - [/card] -[button url="{order_url}"]View Order Details[/button] +[button url="{order_url}"]View Complete Order[/button] + +[card type="success"] +**What Happens Next?** +1. We\'ll verify your payment (2-4 hours) +2. Our team will prepare and pack your items +3. You\'ll get a shipping notification with tracking info +4. Your package will arrive within 3-7 business days + +Most orders ship the same business day! +[/card] [card type="info"] - -**What happens next?** - -Once we confirm your payment, we\'ll prepare your order for shipment and send you a tracking number. This usually takes 1-2 business days. - +๐ **Save this email for reference.** You\'ll need your order number {order_number} if you need to contact us. [/card] [card type="basic"] - -Need help? Contact us: {support_email} - +Questions or need to make changes? Reply to this email or contact us at {support_email} [/card]'; - } + } - /** - * Customer: Order Processing - * Sent when order payment is confirmed and ready for shipment - */ - private static function customer_order_processing() { - return '[card type="success"] + /** + * Customer: Order Pending + * Sent when order is pending payment confirmation + */ + private static function customer_order_pending() + { + return '[card type="info"] +## Your order is pending, {customer_name} -## Great news, {customer_name}! - -Your order #{order_number} is confirmed and being prepared for shipment. +We\'ve received your order #{order_number}, and it\'s waiting for payment confirmation. This usually takes just a few minutes. [/card] [card] - -**Order Number:** #{order_number} -**Order Total:** {order_total} -**Estimated Delivery:** 3-5 business days - -[/card] - -[card] - -โ Payment received -โ Order is being packed -โ You\'ll receive a shipping notification with tracking info - -[/card] - -[button url="{order_url}"]Track Your Order[/button] - -[card type="info"] - -Your order is on its way! You can track your shipment once we dispatch it. - -[/card] - -[card type="basic"] - -Questions? We\'re here to help: {support_email} - -[/card]'; - } - - /** - * Customer: Order Shipped - * Sent when order is dispatched - */ - private static function customer_order_shipped() { - return '[card type="success"] - -## Your order #{order_number} has shipped! - -Track your package and get real-time delivery updates. -[/card] - -[card] - -**Tracking Number:** {tracking_number} -**Carrier:** {shipping_carrier} -**Estimated Delivery:** 2-3 business days - -[/card] - -[button url="{tracking_url}"]Track Your Package[/button] - -[card type="info"] - -Your package is on its way to you. Click the button above to see the current location and estimated delivery date. - -[/card] - -[card] - -**Order Details:** -Order #{order_number} -{order_items_table} - -[/card] - -[card type="basic"] - -Need assistance? Contact {support_email} - -[/card]'; - } - - /** - * Customer: Order Completed - * Sent when order is delivered - */ - private static function customer_order_completed() { - return '[card type="success"] - -## Your order #{order_number} has arrived! - -We hope you love your purchase. Your feedback helps us improve. -[/card] - -[card] - -**Order Number:** #{order_number} -**Delivery Date:** {completion_date} - -[/card] - -[button url="{review_url}"]Share Your Review[/button] - -[card type="info"] - -Your review is valuable to us and helps other customers make informed decisions. Plus, reviewers often get special discounts on future purchases! - -[/card] - -[card] - **Order Summary:** -{order_items_table} - -[/card] - -[card type="basic"] - -Questions or issues with your order? We\'re here to help. - -Contact: {support_email} - -[/card]'; - } - - /** - * Customer: Order Cancelled - * Sent when order is cancelled by customer or staff - */ - private static function customer_order_cancelled() { - return '[card type="warning"] - -## Your order #{order_number} has been cancelled. +Order Number: #{order_number} +Order Total: {order_total} +Payment Method: {payment_method} +Order Date: {order_date} [/card] [card] - -**Order Number:** #{order_number} -**Cancellation Date:** {order_date} -**Order Total:** {order_total} - -[/card] - -[card type="info"] - -If you made a payment, a refund will be processed to your original payment method within 5-7 business days. - -[/card] - -[card] - **Items:** {order_items_table} - [/card] -[button url="{shop_url}"]Continue Shopping[/button] +[button url="{order_url}"]Check Order Status[/button] + +[card type="info"] +โฑ๏ธ If you don\'t see a payment confirmation within 30 minutes, don\'t worry! Click the button above to check the status, or your bank may require additional verification. +[/card] [card type="basic"] - -We\'d love to know why you cancelled. Feel free to reach out to us at {support_email} if there\'s anything we can help with. - +Having payment issues? Contact us at {support_email} and we\'ll help you sort it out quickly. [/card]'; - } + } - /** - * Customer: Payment Received - * Sent when payment is successfully processed - */ - private static function customer_payment_received() { - return '[card type="success"] + /** + * Customer: Order On-Hold + * Sent when order requires customer action + */ + private static function customer_order_on_hold() + { + return '[card type="warning"] +## Your order is on hold, {customer_name} -## Payment confirmed! - -Thank you for your payment. Your order #{order_number} is now being processed. +Order #{order_number} is waiting for payment confirmation. Complete payment now to get your order processing! [/card] [card] - -**Amount Paid:** {order_total} +**Order Number:** #{order_number} +**Order Total:** {order_total} **Payment Method:** {payment_method} -**Transaction ID:** {transaction_id} -**Date:** {payment_date} - [/card] +[button url="{payment_retry_url}"]Complete Payment Now[/button] + [card type="info"] +**Why is this on hold?** +We haven\'t received payment confirmation yet. This is common and easily fixed! -Your order is now being prepared for shipment. You\'ll receive a tracking notification within 1-2 business days. +**Common reasons:** +โข Payment gateway needs more details +โข Bank security check required +โข Payment was declined temporarily +Please try again or contact your bank to authorize this transaction. +[/card] + +[card] +**Don\'t lose your items!** Complete payment within 24 hours to keep your order reserved. After that, items may become unavailable. +[/card] + +[card type="basic"] +Still having trouble? We\'re here: {support_email} +[/card]'; + } + + /** + * Customer: Payment Received + * Sent when payment is successfully processed + */ + private static function customer_payment_received() + { + return '[card type="success"] +## โ Payment confirmed! + +Great news, {customer_name}! Your payment has been successfully processed. Your order #{order_number} is now confirmed and being prepared for shipment. +[/card] + +[card] +**Payment Confirmed:** +Amount: {order_total} +Transaction ID: {transaction_id} +Payment Method: {payment_method} +Date: {payment_date} +[/card] + +[card] +**What\'s next?** +1. Our warehouse team is picking and packing your items (usually 24 hours) +2. We\'ll generate your shipping label and notify you +3. Your package will ship out soon with tracking info +4. Estimated delivery: 3-7 business days [/card] [button url="{order_url}"]View Your Order[/button] -[card] - -Please keep this email for your records. +[card type="info"] +๐ You\'ll receive a shipping notification with tracking information as soon as your package ships. You can follow your delivery in real-time! +[/card] +[card type="basic"] +Questions? Keep this email handy and contact us: {support_email} [/card]'; - } + } - /** - * Customer: Payment Failed - * Sent when payment processing fails - */ - private static function customer_payment_failed() { - return '[card type="warning"] + /** + * Customer: Payment Failed + * Sent when payment processing fails + */ + private static function customer_payment_failed() + { + return '[card type="warning"] +## Payment couldn\'t be processed -## Payment could not be processed - -We were unable to complete the payment for order #{order_number}. Your order is still reserved, but we need you to update your payment information. +We tried to process your payment for order #{order_number}, but it was declined. Don\'t worryโthis is easily fixed, and your order is still reserved! [/card] [card] - -**Order Number:** #{order_number} -**Order Total:** {order_total} -**Reason:** Payment declined - -[/card] - -[card] - -**Common reasons:** -โข Insufficient funds -โข Incorrect card details -โข Card expired or blocked -โข Bank security check - +**Order Details:** +Order Number: #{order_number} +Order Total: {order_total} +Reason: {payment_error_reason} [/card] [button url="{payment_retry_url}"]Update Payment Method[/button] [card type="info"] +**Why did this happen?** +โข Insufficient funds +โข Card expired or blocked +โข Incorrect card details +โข Bank declined for security reasons +โข Wrong billing address -Your order is on hold. Please update your payment information to proceed. If you continue to experience issues, contact your bank or reach out to us. - -[/card] - -[card type="basic"] - -Questions? {support_email} - -[/card]'; - } - - /** - * Customer: New Customer - * Sent when customer creates an account - */ - private static function customer_new_customer() { - return '[card type="hero"] - -# Welcome to {site_name}, {customer_name}! - -Your account is ready. Let\'s get you started. +**Easy fix:** +Try paying with a different card or update your payment method using the button above. [/card] [card] +**Your order is still available for 24 hours.** After that, we\'ll need to release your reserved items. -**Account Benefits:** -โ Faster checkout on your next order -โ Order history and tracking -โ Exclusive member offers and updates -โ Wishlist and saved items -โ Easy returns and exchanges - -[/card] - -[button url="{my_account_url}"]Access Your Account[/button] - -[button url="{shop_url}"]Start Shopping[/button] - -[card type="info"] - -We\'re excited to have you as part of our community. Happy shopping! - +**Action needed:** Please update your payment within 24 hours to proceed with your order. [/card] [card type="basic"] - -Need help? Contact {support_email} - +Still having issues? Our team can help: {support_email} [/card]'; - } + } - /** - * Customer: VIP Upgraded - * Sent when customer is upgraded to VIP status - */ - private static function customer_vip_upgraded() { - return '[card type="success"] + /** + * Customer: Order Processing + * Sent when order payment is confirmed and ready for shipment + */ + private static function customer_order_processing() + { + return '[card type="success"] +## ๐ Your order is being prepared! -## Congratulations, {customer_name}! - -You\'re now a VIP member. +Exciting news, {customer_name}! Your payment has been confirmed and order #{order_number} is now being packed and prepared for shipment. [/card] [card] - -**Your VIP Perks:** -โ Exclusive early access to new products -โ Special VIP-only discounts -โ Priority customer support -โ Free shipping on orders over {vip_free_shipping_threshold} -โ Birthday month bonus gift - -[/card] - -[button url="{vip_dashboard_url}"]View Your VIP Dashboard[/button] - -[card type="info"] - -Simply shop as usualโyour VIP benefits are automatically applied to all your orders. Thank you for your continued loyalty! - -[/card] - -[card type="basic"] - -Questions? {support_email} - -[/card]'; - } - - // ======================================================================== - // STAFF TEMPLATES - // ======================================================================== - - /** - * Staff: Order Placed - * Notifies staff when customer places an order - */ - private static function staff_order_placed() { - return '[card type="hero"] - -# New order received! - -A customer has placed a new order. Please review and process. -[/card] - -[card] - **Order Number:** #{order_number} -**Customer:** {customer_name} -**Order Date:** {order_date} **Order Total:** {order_total} -**Payment Status:** {payment_status} - +**Status:** Being Prepared +**Estimated Dispatch:** Within 24 hours [/card] [card] +**Your Items:** +{order_items_table} +[/card] -**Customer Contact:** +[card type="success"] +**Order Progress:** +โ Payment received +โ Order confirmed +โณ Being packed and quality checked +โณ Generating shipping label +โณ Dispatching your package +[/card] + +[card type="info"] +๐ฆ **You\'re almost there!** Your package will ship within 24 hours. Once it does, you\'ll get a notification with tracking info so you can watch your delivery in real-time. +[/card] + +[button url="{order_url}"]Track Your Order[/button] + +[card type="basic"] +Questions about your order? {support_email} +[/card]'; + } + + /** + * Customer: Order Shipped + * Sent when order is dispatched + */ + private static function customer_order_shipped() + { + return '[card type="success"] +## ๐ Your package is on its way! + +Your order #{order_number} has shipped! Track your package below and get real-time delivery updates. +[/card] + +[card] +**Tracking Information:** +Tracking Number: {tracking_number} +Carrier: {shipping_carrier} +Shipped: {order_date} +Estimated Delivery: 3-7 business days +[/card] + +[button url="{tracking_url}"]Track Your Package[/button] + +[card] +**Your Items:** +{order_items_table} +[/card] + +[card type="info"] +**What to expect:** +โข You\'ll see "In Transit" status once the carrier scans it at their facility +โข Delivery date may update as the package moves +โข You might receive a delivery notification from the carrier +โข Contact the carrier directly if the package doesn\'t arrive by the estimated date + +๐ **Tip:** Add the tracking number to your phone contacts or set email alerts for delivery updates! +[/card] + +[card type="basic"] +Any issues? Contact us: {support_email} +[/card]'; + } + + /** + * Customer: Order Completed + * Sent when order is delivered + */ + private static function customer_order_completed() + { + return '[card type="success"] +## ๐ฆ Your order has arrived! + +Your order #{order_number} has been delivered! We hope you love your purchase. Your feedback helps us provide better service and special offers. +[/card] + +[card] +**Order Summary:** +Order Number: #{order_number} +Delivered: {completion_date} +Order Total: {order_total} +[/card] + +[card] +**Your Items:** +{order_items_table} +[/card] + +[button url="{review_url}"]Share Your Review โญ[/button] + +[card type="success"] +**Why your review matters:** +โ Helps other customers make great choices +โ Helps us improve our products and service +โ Reviewers get exclusive discounts on future purchases! +โ You might be featured on our site + +Leave a review and let us know what you think. Even 2-3 sentences help! +[/card] + +[card type="info"] +**Issues with your order?** If anything\'s wrong, damaged, or not what you expected, let us know immediately. We\'ll make it right! +[/card] + +[button url="{return_url}"]Initiate Return or Exchange[/button] + +[card type="basic"] +Thanks for shopping with us! Questions? {support_email} +[/card]'; + } + + /** + * Customer: Order Failed + * Sent when order fails processing + */ + private static function customer_order_failed() + { + return '[card type="warning"] +## Issue with order #{order_number} + +Unfortunately, we weren\'t able to process your order #{order_number}. This sometimes happens due to system issues or inventory problems. +[/card] + +[card] +**Order Number:** #{order_number} +**Order Total:** {order_total} +**Date:** {order_date} +[/card] + +[card type="info"] +**What now?** +We\'re investigating this issue and our team will contact you shortly with details and next steps. + +In the meantime, you can: +[/card] + +[button url="{shop_url}"]Browse More Products[/button] +[button url="{contact_url}"]Contact Our Team[/button] + +[card] +We apologize for the inconvenience. We\'re here to help make this right! +[/card] + +[card type="basic"] +Questions? Contact us immediately: {support_email} +[/card]'; + } + + /** + * Customer: Order Cancelled + * Sent when order is cancelled + */ + private static function customer_order_cancelled() + { + return '[card type="warning"] +## Order #{order_number} has been cancelled + +Your order has been cancelled. Here\'s what you need to know: +[/card] + +[card] +**Order Details:** +Order Number: #{order_number} +Order Total: {order_total} +Cancellation Date: {order_date} +[/card] + +[card] +**Items That Won\'t Ship:** +{order_items_table} +[/card] + +[card type="success"] +**Refund Status:** +If you made a payment, we\'re processing your refund to your original payment method. This usually takes 5-7 business days, but sometimes longer depending on your bank. +[/card] + +[card type="info"] +**Why was this cancelled?** +This usually happens because: +โข You requested the cancellation +โข Payment couldn\'t be confirmed +โข Items became out of stock +โข You had a payment issue that wasn\'t resolved + +If this wasn\'t your decision and you\'d like to place a new order, we\'re here to help! +[/card] + +[button url="{shop_url}"]Shop Again[/button] +[button url="{contact_url}"]Talk to Us[/button] + +[card type="basic"] +We\'d love to know what we could have done better. Your feedback helps us improve: {support_email} +[/card]'; + } + + /** + * Customer: Order Refunded + * Sent when order is refunded + */ + private static function customer_order_refunded() + { + return '[card type="success"] +## โ Your refund has been processed! + +We\'ve successfully processed a refund of {order_total} for order #{order_number}. +[/card] + +[card] +**Refund Details:** +Order Number: #{order_number} +Refund Amount: {order_total} +Refund Date: {order_date} +Original Payment Method: {payment_method} +[/card] + +[card type="info"] +**When will I see the refund?** +โข 5-10 business days: Most refunds appear within this timeframe +โข 10-14 business days: Some banks take longer to process +โข Check with your bank if it takes longer than 14 days + +The refund will go back to the original payment method you used. If you paid with a credit card, it may show as a credit on your statement. +[/card] + +[card] +**Items Returned:** +{order_items_table} +[/card] + +[card type="basic"] +Have questions about your refund? {support_email} + +We hope to serve you again soon! Check out our new arrivals: +[/card] + +[button url="{shop_url}"]Browse New Products[/button]'; + } + + // ======================================================================== + // STAFF TEMPLATES + // ======================================================================== + + /** + * Staff: Order Placed + * Notifies staff when customer places an order + */ + private static function staff_order_placed() + { + return '[card type="hero"] +## ๐ฌ New Order Received! + +A customer has just placed an order. Review the details below and begin processing. +[/card] + +[card] +**Customer Information:** +Name: {customer_name} Email: {customer_email} Phone: {customer_phone} +**Order Details:** +Order Number: #{order_number} +Order Date: {order_date} +Order Total: {order_total} +Payment Status: {payment_status} [/card] [card] - **Items Ordered:** {order_items_table} - [/card] [card] - -**Delivery Address:** +**Shipping Address:** {shipping_address} +**Billing Address:** +{billing_address} [/card] -[button url="{order_url}"]Process This Order[/button] +[card] +**Payment Method:** {payment_method} +[/card] + +[button url="{order_url}"]Open Order in Dashboard[/button] [card type="info"] +**Next Steps:** +โข Verify payment status +โข Check inventory availability +โข Confirm items are in stock +โข Flag any issues for follow-up +โข Begin picking items when ready -If payment status is "pending", please follow up with the customer or wait for payment confirmation before processing. +**โ ๏ธ Action Required:** If payment status is not confirmed, follow up with customer or wait for payment gateway to process. +[/card] +[card type="basic"] +Questions or issues? Check the dashboard or contact management. [/card]'; - } + } - /** - * Staff: Order Processing - * Notifies staff when order is confirmed and ready to process - */ - private static function staff_order_processing() { - return '[card type="success"] + /** + * Staff: Order Pending + * Notifies staff of pending orders awaiting payment + */ + private static function staff_order_pending() + { + return '[card type="info"] +## โฑ๏ธ Order Pending Payment -## Order confirmed and ready to process - -Order #{order_number} is confirmed. Payment has been received. Begin preparation. +Order #{order_number} from {customer_name} is awaiting payment confirmation. [/card] [card] - -**Order Number:** #{order_number} **Customer:** {customer_name} +**Order Number:** #{order_number} **Order Total:** {order_total} -**Confirmed Date:** {order_date} - +**Payment Method:** {payment_method} +**Date Placed:** {order_date} [/card] [card] +**Items:** +{order_items_table} +[/card] +[button url="{order_url}"]View in Dashboard[/button] + +[card type="info"] +**Action Items:** +โข Monitor payment status +โข Prepare items if pre-order or inventory allows +โข Contact customer if payment isn\'t received within 24 hours +โข Consider automatic cancellation if payment not received after configured timeout +[/card]'; + } + + /** + * Staff: Order On-Hold + * Notifies staff when order requires customer attention + */ + private static function staff_order_on_hold() + { + return '[card type="warning"] +## ๐ Order On-Hold + +Order #{order_number} from {customer_name} is on hold. Action required from customer. +[/card] + +[card] +**Customer:** {customer_name} +**Email:** {customer_email} +**Order Number:** #{order_number} +**Order Total:** {order_total} +**Hold Reason:** Awaiting payment confirmation +[/card] + +[button url="{order_url}"]View Order[/button] + +[card type="info"] +**Status:** Waiting for customer to complete payment or resolve issue. + +**Recommended Actions:** +โข Wait 24 hours for customer response +โข Send manual follow-up if no response +โข Check customer\'s email for payment retry +โข Consider auto-cancellation per your policy +[/card]'; + } + + /** + * Staff: Payment Received + * Notifies staff when payment is successfully received + */ + private static function staff_payment_received() + { + return '[card type="success"] +## โ Payment Received! + +Payment successfully processed for order #{order_number}. Order is now ready for fulfillment. +[/card] + +[card] +**Payment Details:** +Amount: {order_total} +Payment Method: {payment_method} +Transaction ID: {transaction_id} +Date: {payment_date} + +**Customer:** {customer_name} +**Order Number:** #{order_number} +[/card] + +[card] **Items to Prepare:** {order_items_table} +[/card] +[card type="success"] +**Ready to Process:** +โ Payment confirmed +โ Order in system +๐ฆ Begin picking and packing +๐ท๏ธ Generate shipping label +๐ฎ Prepare for dispatch +[/card] + +[button url="{order_url}"]Start Processing[/button] + +[card type="info"] +Order is now confirmed and ready for fulfillment. Begin preparation immediately to meet dispatch targets. +[/card]'; + } + + /** + * Staff: Payment Failed + * Notifies staff when payment processing fails + */ + private static function staff_payment_failed() + { + return '[card type="warning"] +## โ ๏ธ Payment Failed + +Payment processing failed for order #{order_number}. Order is on hold pending customer action. [/card] [card] +**Order Details:** +Order Number: #{order_number} +Customer: {customer_name} +Amount: {order_total} +Payment Method: {payment_method} +Failed Date: {payment_date} +Failure Reason: {payment_error_reason} +[/card] + +[button url="{order_url}"]View Details[/button] + +[card type="warning"] +**Status:** On Hold - Awaiting Payment Retry **Action Items:** -โข Verify inventory and pick items -โข Quality check -โข Pack securely -โข Generate shipping label -โข Update order status when shipped - +1. Customer has been notified automatically +2. Order is reserved for 24 hours +3. Monitor for payment retry from customer +4. After 24 hours with no payment: auto-cancel per policy or contact customer +5. Do NOT prepare items until payment is confirmed [/card] -[button url="{order_url}"]View Full Order[/button]'; - } +[card type="info"] +**Follow-Up Timeline:** +โข 0 hours: Payment fails, customer notified +โข 12 hours: Check if customer retried payment +โข 24 hours: Reach out to customer if no payment received +โข 48 hours: Consider cancellation if no response +[/card]'; + } - /** - * Staff: Order Shipped - * Notifies staff when order is marked as shipped - */ - private static function staff_order_shipped() { - return '[card type="success"] + /** + * Staff: Order Processing + * Notifies staff when order is confirmed and ready to process + */ + private static function staff_order_processing() + { + return '[card type="success"] +## โ Order Confirmed & Ready to Process -## Order shipped - -Order #{order_number} has been dispatched. Customer notified with tracking info. +Order #{order_number} is confirmed. Payment received. Begin preparation and packing immediately. [/card] [card] +**Order Details:** +Order Number: #{order_number} +Customer: {customer_name} +Order Total: {order_total} +Confirmed Date: {order_date} +[/card] -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Tracking Number:** {tracking_number} -**Carrier:** {shipping_carrier} -**Shipped Date:** {order_date} +[card] +**Items to Pick & Pack:** +{order_items_table} +[/card] +[card type="success"] +**Fulfillment Checklist:** +โ Pick all items from inventory +โ Verify quality and condition +โ Pack securely with packing material +โ Generate shipping label +โ Weigh and verify dimensions +โ Arrange pickup with carrier +โ Update order status to "Shipped" +โ Send tracking info to customer +[/card] + +[button url="{order_url}"]Open Full Order[/button] + +[card type="info"] +**Target Dispatch:** Within 24 hours +Keep this order moving through fulfillment to maintain on-time delivery. +[/card]'; + } + + /** + * Staff: Order Shipped + * Notifies staff when order is marked as shipped + */ + private static function staff_order_shipped() + { + return '[card type="success"] +## ๐ฎ Order Shipped + +Order #{order_number} has been dispatched. Customer automatically notified with tracking information. +[/card] + +[card] +**Order Details:** +Order Number: #{order_number} +Customer: {customer_name} +Tracking Number: {tracking_number} +Carrier: {shipping_carrier} +Shipped Date: {order_date} [/card] [button url="{order_url}"]View Order[/button] +[card type="success"] +โ Picked and packed +โ Shipping label generated +โ Picked up by carrier +โ Customer notified with tracking info + +**Customer can now track their shipment in real-time.** +[/card] + [card type="info"] - -Customer has been automatically notified via email with tracking details. - +Order is in transit. Monitor for any delivery issues or customer inquiries about tracking. [/card]'; - } + } - /** - * Staff: Order Completed - * Notifies staff when order is completed/delivered - */ - private static function staff_order_completed() { - return '[card type="success"] + /** + * Staff: Order Completed + * Notifies staff when order is completed/delivered + */ + private static function staff_order_completed() + { + return '[card type="success"] +## โ Order Completed -## Order completed - -Order #{order_number} has been delivered to customer. All steps completed. +Order #{order_number} has been delivered to customer. All fulfillment steps completed successfully. [/card] [card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Order Total:** {order_total} -**Completed Date:** {order_date} - +**Order Summary:** +Order Number: #{order_number} +Customer: {customer_name} +Order Total: {order_total} +Completed Date: {order_date} [/card] [card] - -**Order Timeline:** +**Order Journey:** โ Order placed โ Payment received -โ Order prepared and packed -โ Shipped -โ Delivered - +โ Order prepared & packed +โ Shipped with tracking +โ Delivered to customer [/card] -[button url="{order_url}"]View Order[/button] - -[card type="info"] - -Customer has been notified and invited to leave a review. - -[/card]'; - } - - /** - * Staff: Order Cancelled - * Notifies staff when order is cancelled - */ - private static function staff_order_cancelled() { - return '[card type="warning"] - -## Order cancelled - -Order #{order_number} has been cancelled. Please process refund if payment was received. -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Order Total:** {order_total} -**Cancelled Date:** {order_date} - -[/card] - -[card] - -**Items (will not ship):** -{order_items_table} - -[/card] - -[card] - -**Action Items:** -โข If payment received: Process refund to original payment method -โข Update inventory for cancelled items -โข Check warehouse if order was already being prepared -โข Confirm cancellation with customer - -[/card] - -[button url="{order_url}"]View Order & Process Refund[/button] - -[card type="info"] - -Customer has been notified of the cancellation. - -[/card]'; - } - - /** - * Staff: Payment Received - * Notifies staff when payment is successfully received - */ - private static function staff_payment_received() { - return '[card type="success"] - -## Payment received - -Payment has been successfully processed for order #{order_number}. Ready to begin order processing. -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Amount:** {order_total} -**Payment Method:** {payment_method} -**Transaction ID:** {transaction_id} -**Date:** {payment_date} - -[/card] - -[card] - -**Next Steps:** -โข Confirm the order -โข Begin item preparation -โข Prepare shipping label -โข Update customer with tracking info - -[/card] - -[button url="{order_url}"]Process Order[/button] - -[card type="info"] - -Order is now confirmed and ready for fulfillment. - -[/card]'; - } - - /** - * Staff: Payment Failed - * Notifies staff when payment processing fails - */ - private static function staff_payment_failed() { - return '[card type="warning"] - -## Payment failed - -Payment processing failed for order #{order_number}. Order is on hold pending payment. -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Amount:** {order_total} -**Payment Method:** {payment_method} -**Failed Date:** {payment_date} - -[/card] - -[card] - -**Action Items:** -โข Customer has been notified to update payment -โข Check order status after 24 hours -โข If still unpaid, consider cancelling -โข Contact customer if needed +[card type="success"] +**Customer Experience:** +โ Customer notified +โ Invited to leave review +โ Offered return option +โ Follow-up actions triggered +Consider this order a success! [/card] [button url="{order_url}"]View Order Details[/button] [card type="info"] - -Order is reserved but will be cancelled automatically if payment is not received within 24-48 hours (configure this in settings). - +Monitor for customer reviews and feedback. Flag any issues that arise for continuous improvement. [/card]'; - } + } - // ======================================================================== - // ADDITIONAL ORDER STATUS TEMPLATES - // ======================================================================== - - /** - * Customer: Order On-Hold - */ - private static function customer_order_on_hold() { - return '[card type="info"] - -## Your order is on hold - -Your order #{order_number} is awaiting payment confirmation. + /** + * Staff: Order Failed + * Notifies staff when order fails + */ + private static function staff_order_failed() + { + return '[card type="warning"] +## โ Order Failed +Order #{order_number} from {customer_name} could not be processed. Immediate action required. [/card] [card] - -**Order Number:** #{order_number} -**Order Total:** {order_total} -**Payment Method:** {payment_method} - +**Order Details:** +Order Number: #{order_number} +Customer: {customer_name} +Order Total: {order_total} +Failure Date: {order_date} [/card] -[button url="{payment_retry_url}"]Complete Payment[/button] - -[card] - -Questions? Contact us: {support_email} - -[/card]'; - } - - /** - * Customer: Order Failed - */ - private static function customer_order_failed() { - return '[card type="warning"] - -## Order #{order_number} has failed - -Unfortunately, your order could not be processed. - -[/card] - -[card] - -**Order Number:** #{order_number} -**Order Total:** {order_total} -**Reason:** Payment could not be processed - -[/card] - -[button url="{shop_url}"]Continue Shopping[/button] - -[card] - -Need help? Contact: {support_email} - -[/card]'; - } - - /** - * Customer: Order Refunded - */ - private static function customer_order_refunded() { - return '[card type="success"] - -## Your order #{order_number} has been refunded - -Your refund has been processed successfully. - -[/card] - -[card] - -**Order Number:** #{order_number} -**Refund Amount:** {order_total} -**Refund Date:** {order_date} +[button url="{order_url}"]View Details & Investigate[/button] +[card type="warning"] +**Immediate Actions Required:** +1. Investigate the failure reason (payment? inventory? system?) +2. Contact customer with explanation and solution +3. Offer alternatives (different payment method, substitute items, etc.) +4. Provide timeline for resolution +5. Process refund if no resolution path found [/card] [card type="info"] - -The refund will appear in your account within 5-10 business days depending on your payment provider. - -[/card] - -[card] - -Questions? Contact: {support_email} - +This order requires staff attention to resolve and maintain customer satisfaction. [/card]'; - } + } - /** - * Customer: Order Pending - */ - private static function customer_order_pending() { - return '[card type="info"] - -## Thank you for your order! - -Your order #{order_number} is pending and will be processed once payment is confirmed. + /** + * Staff: Order Cancelled + * Notifies staff when order is cancelled + */ + private static function staff_order_cancelled() + { + return '[card type="warning"] +## โ Order Cancelled +Order #{order_number} from {customer_name} has been cancelled. Refund processing may be required. [/card] [card] - -**Order Number:** #{order_number} -**Order Total:** {order_total} -**Payment Method:** {payment_method} - +**Order Details:** +Order Number: #{order_number} +Customer: {customer_name} +Order Total: {order_total} +Cancelled Date: {order_date} [/card] [card] - +**Items (Will Not Ship):** {order_items_table} +[/card] +[card type="warning"] +**Action Items:** +โ Check if payment was received +โ If paid: Process refund to original payment method +โ Update inventory for cancelled items +โ Check warehouse if order was partially prepared +โ Confirm cancellation with customer +โ Log cancellation reason for analytics +[/card] + +[card type="info"] +**Refund Timeline:** +โข Immediate: Process refund in system +โข 5-10 days: Customer sees refund in their account +โข Communicate expected timeline to customer +[/card] + +[button url="{order_url}"]View & Process Refund[/button] + +[card type="basic"] +Document the cancellation reason for business intelligence. Customer satisfaction is important. +[/card]'; + } + + /** + * Staff: Order Refunded + * Notifies staff when order is refunded + */ + private static function staff_order_refunded() + { + return '[card type="success"] +## โ Refund Processed + +Order #{order_number} has been refunded. Customer automatically notified of refund details. +[/card] + +[card] +**Refund Details:** +Order Number: #{order_number} +Customer: {customer_name} +Refund Amount: {order_total} +Refund Date: {order_date} [/card] [button url="{order_url}"]View Order[/button] -[card] - -Questions? Contact: {support_email} +[card type="success"] +โ Refund processed to: {payment_method} +โ Customer notified with timeline +โ Expected to appear: 5-10 business days +โ Order status updated +[/card] +[card type="info"] +Customer will see refund in their account within 5-10 business days depending on their bank. Flag if customer inquires about missing refund after 14 days. [/card]'; - } - - /** - * Staff: Order On-Hold - */ - private static function staff_order_on_hold() { - return '[card type="info"] - -## Order #{order_number} is on hold - -Awaiting payment confirmation from {customer_name}. - -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Order Total:** {order_total} -**Payment Method:** {payment_method} - -[/card] - -[button url="{order_url}"]View Order[/button]'; - } - - /** - * Staff: Order Failed - */ - private static function staff_order_failed() { - return '[card type="warning"] - -## Order #{order_number} has failed - -Order from {customer_name} could not be processed. - -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Order Total:** {order_total} - -[/card] - -[button url="{order_url}"]View Details[/button]'; - } - - /** - * Staff: Order Refunded - */ - private static function staff_order_refunded() { - return '[card type="success"] - -## Order #{order_number} has been refunded - -Refund processed for {customer_name}. - -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Refund Amount:** {order_total} - -[/card] - -[button url="{order_url}"]View Order[/button]'; - } - - /** - * Staff: Order Pending - */ - private static function staff_order_pending() { - return '[card type="info"] - -## New pending order #{order_number} - -Order from {customer_name} is pending payment. - -[/card] - -[card] - -**Order Number:** #{order_number} -**Customer:** {customer_name} -**Order Total:** {order_total} - -[/card] - -[button url="{order_url}"]View Order[/button]'; - } -} + } +} \ No newline at end of file