1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
<?php
namespace SIW\WooCommerce\Email;
class Customer_On_Hold_Order {
public static function init() {
$self = new self();
add_filter( 'woocommerce_email_subject_customer_on_hold_order', [ $self, 'set_subject'], 10, 2 );
add_filter( 'woocommerce_email_heading_customer_on_hold_order', [ $self, 'set_heading'], 10, 2 );
add_filter( 'wc_get_template', [ $self, 'set_template'], 10, 5 );
}
public function set_subject( string $subject, \WC_Order $order ) {
return sprintf( __( 'Aanmelding %s', 'siw' ), $order->get_order_number() );
}
public function set_heading( string $heading, \WC_Order $order ) {
return sprintf( __( 'Bevestiging aanmelding #%s', 'siw' ), $order->get_order_number() );
}
public function set_template( string $located, string $template_name, array $args, string $template_path, string $default_path ) {
if ( 'emails/customer-on-hold-order.php' === $template_name ) {
$located = SIW_TEMPLATES_DIR . '/woocommerce/'. $template_name;
}
return $located;
}
}