PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.2
YayMail – WooCommerce Email Customizer v4.4.2
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / Emails / CustomerPOSCompletedOrder.php

CustomerPOSCompletedOrder.php in YayMail – WooCommerce Email Customizer 4.4.2, at src/Emails/CustomerPOSCompletedOrder.php

93 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMail\Emails;
4
5 use YayMail\Abstracts\BaseEmail;
6 use YayMail\Elements\ElementsLoader;
7 use YayMail\Utils\SingletonTrait;
8
9 /**
10 * CustomerPOSCompletedOrder Class
11 * From WC 9.9.3
12 *
13 * @since 4.0.6
14 * @method static CustomerPOSCompletedOrder get_instance()
15 */
16 class CustomerPOSCompletedOrder extends BaseEmail {
17 use SingletonTrait;
18
19 protected function __construct() {
20 $emails = \WC_Emails::instance()->get_emails();
21 $email = $emails['WC_Email_Customer_POS_Completed_Order'] ?? null;
22 if ( ! $email ) {
23 return;
24 }
25 $this->id = $email->id;
26 $this->title = $email->get_title();
27 $this->root_email = $email;
28 $this->recipient = function_exists( 'yaymail_get_email_recipient_zone' ) ? yaymail_get_email_recipient_zone( $email ) : '';
29
30 $this->render_priority = apply_filters( 'yaymail_email_render_priority', $this->render_priority, $this->id );
31 add_filter( 'wc_get_template', [ $this, 'get_template_file' ], $this->render_priority ?? 10, 3 );
32 $this->maybe_disable_block_email_editor();
33 }
34
35 public function get_default_elements() {
36 $email_title = __( 'Thanks for shopping with us', 'woocommerce' );
37 // translators: customer name.
38 $email_hi = sprintf( esc_html__( 'Hi %s,', 'woocommerce' ), '[yaymail_billing_first_name]' );
39 $email_text = esc_html__( 'We have finished processing your order.', 'woocommerce' );
40 $additional_text = __( 'Thanks for shopping with us.', 'woocommerce' );
41 $additional_text = str_replace( '{site_url}!', '', $additional_text );
42
43 $default_elements = ElementsLoader::load_elements(
44 [
45 [
46 'type' => 'Logo',
47 ],
48 [
49 'type' => 'Heading',
50 'attributes' => [
51 'rich_text' => $email_title,
52 ],
53 ],
54 [
55 'type' => 'Text',
56 'attributes' => [
57 'rich_text' => '<p><span>' . $email_hi . '<br /><br /></span></p><p><span>' . $email_text . '</span></p>',
58 ],
59 ],
60 [
61 'type' => 'OrderDetailsDownload',
62 ],
63 [
64 'type' => 'OrderDetails',
65 ],
66 [
67 'type' => 'BillingShippingAddress',
68 ],
69 [
70 'type' => 'Text',
71 'attributes' => [
72 'rich_text' => '<p><span>' . $additional_text . '</span></p>',
73 'padding' => [
74 'top' => '0',
75 'right' => '50',
76 'bottom' => '38',
77 'left' => '50',
78 ],
79 ],
80 ],
81 [
82 'type' => 'Footer',
83 ],
84 ]
85 );
86 return $default_elements;
87 }
88
89 public function get_template_path() {
90 return yaymail_get_template( 'emails/customer-pos-completed-order.php', '', YAYMAIL_PLUGIN_PATH . 'templates/' );
91 }
92 }
93