WC_Email_Customer_Note

Customer Note Order Email.

Defined (1)

The class is defined in the following location(s).

/includes/emails/class-wc-email-customer-note.php  
  1. class WC_Email_Customer_Note extends WC_Email { 
  2.  
  3. /** 
  4. * Customer note. 
  5. * @var string 
  6. */ 
  7. public $customer_note; 
  8.  
  9. /** 
  10. * Constructor. 
  11. */ 
  12. public function __construct() { 
  13.  
  14. $this->id = 'customer_note'; 
  15. $this->customer_email = true; 
  16. $this->title = __( 'Customer note', 'woocommerce' ); 
  17. $this->description = __( 'Customer note emails are sent when you add a note to an order.', 'woocommerce' ); 
  18.  
  19. $this->template_html = 'emails/customer-note.php'; 
  20. $this->template_plain = 'emails/plain/customer-note.php'; 
  21.  
  22. $this->subject = __( 'Note added to your {site_title} order from {order_date}', 'woocommerce' ); 
  23. $this->heading = __( 'A note has been added to your order', 'woocommerce' ); 
  24.  
  25. // Triggers 
  26. add_action( 'woocommerce_new_customer_note_notification', array( $this, 'trigger' ) ); 
  27.  
  28. // Call parent constructor 
  29. parent::__construct(); 
  30.  
  31. /** 
  32. * Trigger. 
  33. * @param array $args 
  34. */ 
  35. public function trigger( $args ) { 
  36.  
  37. if ( ! empty( $args ) ) { 
  38.  
  39. $defaults = array( 
  40. 'order_id' => '',  
  41. 'customer_note' => '',  
  42. ); 
  43.  
  44. $args = wp_parse_args( $args, $defaults ); 
  45.  
  46. extract( $args ); 
  47.  
  48. if ( $order_id && ( $this->object = wc_get_order( $order_id ) ) ) { 
  49. $this->recipient = $this->object->get_billing_email(); 
  50. $this->customer_note = $customer_note; 
  51.  
  52. $this->find['order-date'] = '{order_date}'; 
  53. $this->find['order-number'] = '{order_number}'; 
  54.  
  55. $this->replace['order-date'] = wc_format_datetime( $this->object->get_date_created() ); 
  56. $this->replace['order-number'] = $this->object->get_order_number(); 
  57. } else { 
  58. return; 
  59.  
  60. if ( ! $this->is_enabled() || ! $this->get_recipient() ) { 
  61. return; 
  62.  
  63. $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); 
  64.  
  65. /** 
  66. * Get content html. 
  67. * @access public 
  68. * @return string 
  69. */ 
  70. public function get_content_html() { 
  71. return wc_get_template_html( $this->template_html, array( 
  72. 'order' => $this->object,  
  73. 'email_heading' => $this->get_heading(),  
  74. 'customer_note' => $this->customer_note,  
  75. 'sent_to_admin' => false,  
  76. 'plain_text' => false,  
  77. 'email' => $this,  
  78. ) ); 
  79.  
  80. /** 
  81. * Get content plain. 
  82. * @access public 
  83. * @return string 
  84. */ 
  85. public function get_content_plain() { 
  86. return wc_get_template_html( $this->template_plain, array( 
  87. 'order' => $this->object,  
  88. 'email_heading' => $this->get_heading(),  
  89. 'customer_note' => $this->customer_note,  
  90. 'sent_to_admin' => false,  
  91. 'plain_text' => true,  
  92. 'email' => $this,  
  93. ) );