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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / emails / class-wc-email-customer-invoice.php
woocommerce / includes / emails Last commit date
class-wc-email-admin-payment-gateway-enabled.php 1 month ago class-wc-email-cancelled-order.php 1 month ago class-wc-email-customer-cancelled-order.php 1 month ago class-wc-email-customer-completed-order.php 1 month ago class-wc-email-customer-failed-order.php 1 month ago class-wc-email-customer-fulfillment-created.php 1 month ago class-wc-email-customer-fulfillment-deleted.php 1 month ago class-wc-email-customer-fulfillment-updated.php 1 month ago class-wc-email-customer-invoice.php 1 month ago class-wc-email-customer-new-account.php 1 month ago class-wc-email-customer-note.php 1 month ago class-wc-email-customer-on-hold-order.php 1 month ago class-wc-email-customer-partially-refunded-order.php 4 months ago class-wc-email-customer-pos-completed-order.php 1 month ago class-wc-email-customer-pos-refunded-order.php 1 month ago class-wc-email-customer-processing-order.php 1 month ago class-wc-email-customer-refunded-order.php 1 month ago class-wc-email-customer-reset-password.php 1 month ago class-wc-email-customer-review-request.php 1 month ago class-wc-email-failed-order.php 1 month ago class-wc-email-new-order.php 1 month ago class-wc-email.php 1 month ago
class-wc-email-customer-invoice.php
270 lines
1 <?php
2 /**
3 * Class WC_Email_Customer_Invoice file.
4 *
5 * @package WooCommerce\Emails
6 */
7
8 use Automattic\WooCommerce\Enums\OrderStatus;
9 use Automattic\WooCommerce\Utilities\FeaturesUtil;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly.
13 }
14
15 if ( ! class_exists( 'WC_Email_Customer_Invoice', false ) ) :
16
17 /**
18 * Order details email.
19 *
20 * An email sent to the customer via admin, that summarizes the details of their order. This was
21 * historically referred to as the 'invoice', and for backwards compatibility reasons that is still
22 * reflected in the class name (although on a user-level we have moved away from that nomenclature).
23 *
24 * @class WC_Email_Customer_Invoice
25 * @version 3.5.0
26 * @package WooCommerce\Classes\Emails
27 * @extends WC_Email
28 */
29 class WC_Email_Customer_Invoice extends WC_Email {
30
31 /**
32 * Constructor.
33 */
34 public function __construct() {
35 $this->id = 'customer_invoice';
36 $this->customer_email = true;
37 $this->title = __( 'Order details', 'woocommerce' );
38 $this->email_group = 'payments';
39 $this->template_html = 'emails/customer-invoice.php';
40 $this->template_plain = 'emails/plain/customer-invoice.php';
41 $this->placeholders = array(
42 '{order_date}' => '',
43 '{order_number}' => '',
44 );
45
46 // Call parent constructor.
47 parent::__construct();
48
49 // Must be after parent's constructor which sets `email_improvements_enabled` property.
50 $this->description = $this->email_improvements_enabled
51 ? __( 'Manually send an email to your customers containing their order information and payment links', 'woocommerce' )
52 : __( 'Order detail emails can be sent to customers containing their order information and payment links.', 'woocommerce' );
53
54 $this->manual = true;
55
56 if ( $this->block_email_editor_enabled ) {
57 $this->title = __( 'Payment request', 'woocommerce' );
58 $this->description = __( 'Manually send customers an email to review their order and complete payment.', 'woocommerce' );
59 }
60 }
61
62 /**
63 * Get email subject.
64 *
65 * @param bool $paid Whether the order has been paid or not.
66 * @since 3.1.0
67 * @return string
68 */
69 public function get_default_subject( $paid = false ) {
70 return __( 'Details for order #{order_number} on {site_title}', 'woocommerce' );
71 }
72
73 /**
74 * Get email heading.
75 *
76 * @param bool $paid Whether the order has been paid or not.
77 * @since 3.1.0
78 * @return string
79 */
80 public function get_default_heading( $paid = false ) {
81 return __( 'Details for order #{order_number}', 'woocommerce' );
82 }
83
84 /**
85 * Get email subject.
86 *
87 * @return string
88 */
89 public function get_subject() {
90 if ( $this->object->has_status( array( OrderStatus::COMPLETED, OrderStatus::PROCESSING ) ) ) {
91 $subject = $this->get_option( 'subject_paid', $this->get_default_subject( true ) );
92
93 if ( $this->block_email_editor_enabled ) {
94 $subject = $this->personalizer->personalize_transactional_content( $subject, $this );
95 }
96
97 return apply_filters( 'woocommerce_email_subject_customer_invoice_paid', $this->format_string( $subject ), $this->object, $this );
98 }
99
100 $subject = $this->get_option( 'subject', $this->get_default_subject() );
101
102 if ( $this->block_email_editor_enabled ) {
103 $subject = $this->personalizer->personalize_transactional_content( $subject, $this );
104 }
105
106 return apply_filters( 'woocommerce_email_subject_customer_invoice', $this->format_string( $subject ), $this->object, $this );
107 }
108
109 /**
110 * Get email heading.
111 *
112 * @return string
113 */
114 public function get_heading() {
115 if ( $this->object->has_status( wc_get_is_paid_statuses() ) ) {
116 $heading = $this->get_option( 'heading_paid', $this->get_default_heading( true ) );
117 return apply_filters( 'woocommerce_email_heading_customer_invoice_paid', $this->format_string( $heading ), $this->object, $this );
118 }
119
120 $heading = $this->get_option( 'heading', $this->get_default_heading() );
121 return apply_filters( 'woocommerce_email_heading_customer_invoice', $this->format_string( $heading ), $this->object, $this );
122 }
123
124 /**
125 * Default content to show below main email content.
126 *
127 * @since 3.7.0
128 * @return string
129 */
130 public function get_default_additional_content() {
131 return $this->email_improvements_enabled
132 ? __( 'Thanks again! If you need any help with your order, please contact us at {store_email}.', 'woocommerce' )
133 : __( 'Thanks for using {site_url}!', 'woocommerce' );
134 }
135
136 /**
137 * Trigger the sending of this email.
138 *
139 * @param int $order_id The order ID.
140 * @param WC_Order $order Order object.
141 */
142 public function trigger( $order_id, $order = false ) {
143 $this->setup_locale();
144
145 if ( $order_id && ! is_a( $order, 'WC_Order' ) ) {
146 $order = wc_get_order( $order_id );
147 }
148
149 if ( is_a( $order, 'WC_Order' ) ) {
150 $this->object = $order;
151 $this->recipient = $this->object->get_billing_email();
152 $this->placeholders['{order_date}'] = wc_format_datetime( $this->object->get_date_created() );
153 $this->placeholders['{order_number}'] = $this->object->get_order_number();
154 }
155
156 $this->send_if_recipient();
157
158 $this->restore_locale();
159 }
160
161 /**
162 * Get content html.
163 *
164 * @return string
165 */
166 public function get_content_html() {
167 return wc_get_template_html(
168 $this->template_html,
169 array(
170 'order' => $this->object,
171 'email_heading' => $this->get_heading(),
172 'additional_content' => $this->get_additional_content(),
173 'sent_to_admin' => false,
174 'plain_text' => false,
175 'email' => $this,
176 )
177 );
178 }
179
180 /**
181 * Get content plain.
182 *
183 * @return string
184 */
185 public function get_content_plain() {
186 return wc_get_template_html(
187 $this->template_plain,
188 array(
189 'order' => $this->object,
190 'email_heading' => $this->get_heading(),
191 'additional_content' => $this->get_additional_content(),
192 'sent_to_admin' => false,
193 'plain_text' => true,
194 'email' => $this,
195 )
196 );
197 }
198
199 /**
200 * Initialise settings form fields.
201 */
202 public function init_form_fields() {
203 /* translators: %s: list of placeholders */
204 $placeholder_text = sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '<code>' . esc_html( implode( '</code>, <code>', array_keys( $this->placeholders ) ) ) . '</code>' );
205 $this->form_fields = array(
206 'subject' => array(
207 'title' => __( 'Subject', 'woocommerce' ),
208 'type' => 'text',
209 'desc_tip' => true,
210 'description' => $placeholder_text,
211 'placeholder' => $this->get_default_subject(),
212 'default' => '',
213 ),
214 'heading' => array(
215 'title' => __( 'Email heading', 'woocommerce' ),
216 'type' => 'text',
217 'desc_tip' => true,
218 'description' => $placeholder_text,
219 'placeholder' => $this->get_default_heading(),
220 'default' => '',
221 ),
222 'subject_paid' => array(
223 'title' => __( 'Subject (paid)', 'woocommerce' ),
224 'type' => 'text',
225 'desc_tip' => true,
226 'description' => $placeholder_text,
227 'placeholder' => $this->get_default_subject( true ),
228 'default' => '',
229 ),
230 'heading_paid' => array(
231 'title' => __( 'Email heading (paid)', 'woocommerce' ),
232 'type' => 'text',
233 'desc_tip' => true,
234 'description' => $placeholder_text,
235 'placeholder' => $this->get_default_heading( true ),
236 'default' => '',
237 ),
238 'additional_content' => array(
239 'title' => __( 'Additional content', 'woocommerce' ),
240 'description' => __( 'Text to appear below the main email content.', 'woocommerce' ) . ' ' . $placeholder_text,
241 'css' => 'width:400px; height: 75px;',
242 'placeholder' => __( 'N/A', 'woocommerce' ),
243 'type' => 'textarea',
244 'default' => $this->get_default_additional_content(),
245 'desc_tip' => true,
246 ),
247 'email_type' => array(
248 'title' => __( 'Email type', 'woocommerce' ),
249 'type' => 'select',
250 'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
251 'default' => 'html',
252 'class' => 'email_type wc-enhanced-select',
253 'options' => $this->get_email_type_options(),
254 'desc_tip' => true,
255 ),
256 );
257 if ( FeaturesUtil::feature_is_enabled( 'email_improvements' ) ) {
258 $this->form_fields['cc'] = $this->get_cc_field();
259 $this->form_fields['bcc'] = $this->get_bcc_field();
260 }
261 if ( $this->block_email_editor_enabled ) {
262 $this->form_fields['preheader'] = $this->get_preheader_field();
263 }
264 }
265 }
266
267 endif;
268
269 return new WC_Email_Customer_Invoice();
270