get_status() !== 'pending' ) { return; } $invoice_email = WC()->mailer()->emails['WC_Email_Customer_Invoice'] ?? null; if ( $invoice_email ) { $invoice_email->trigger( $order_id ); } } public function custom_invoice_pending_subject( $subject, $order ) { if ( ! $order instanceof \WC_Order ) { return $subject; } if ( 'pending' !== $order->get_status() ) { return $subject; } $custom = get_option( 'aisp_otools_subject_invoice_pending', '' ); if ( ! empty( $custom ) ) { return AISP_OTools_Email_Helper::replace_placeholders( $custom, $order ); } $default = sprintf(// translators: #%s is the order number (e.g 1234) __( 'Your order #%s is awaiting payment', 'aisp-order-tools-for-woocommerce' ), $order->get_order_number() ); return AISP_OTools_Email_Helper::replace_placeholders( $default, $order ); } public function custom_customer_subject( $subject, $order ) { if ( ! $order instanceof \WC_Order ) { return $subject; } $status = $order->get_status(); $new_subject = ''; switch ( $status ) { case 'pending': $new_subject = get_option( 'aisp_otools_subject_pending', __( 'Your order is awaiting payment', 'aisp-order-tools-for-woocommerce' ) ); break; case 'on-hold': $new_subject = get_option( 'aisp_otools_subject_on_hold', __( 'Your order is currently on hold', 'aisp-order-tools-for-woocommerce' ) ); break; case 'processing': $new_subject = get_option( 'aisp_otools_subject_processing', __( 'We have received your payment for this order', 'aisp-order-tools-for-woocommerce' ) ); break; case 'completed': $new_subject = get_option( 'aisp_otools_subject_completed', __( 'Your order is now complete', 'aisp-order-tools-for-woocommerce' ) ); break; } if ( empty( $new_subject ) ) { return $subject; } return AISP_OTools_Email_Helper::replace_placeholders( $new_subject, $order ); } }