Fix and standardize e-mail sending
This commit is contained in:
parent
feeb98e801
commit
ab8fb48bb4
|
@ -130,7 +130,7 @@ class WC_Meta_Box_Order_Actions {
|
|||
if ( ! empty( $mails ) ) {
|
||||
foreach ( $mails as $mail ) {
|
||||
if ( $mail->id == $email_to_send ) {
|
||||
$mail->trigger( $order->get_id() );
|
||||
$mail->trigger( $order->get_id(), $order );
|
||||
/* translators: %s: email title */
|
||||
$order->add_order_note( sprintf( __( '%s email notification manually sent.', 'woocommerce' ), $mail->title ), false, true );
|
||||
}
|
||||
|
|
|
@ -260,7 +260,12 @@ class WC_Emails {
|
|||
*/
|
||||
public function customer_invoice( $order ) {
|
||||
$email = $this->emails['WC_Email_Customer_Invoice'];
|
||||
$email->trigger( $order );
|
||||
|
||||
if ( ! is_object( $order ) ) {
|
||||
$order = wc_get_order( absint( $order ) );
|
||||
}
|
||||
|
||||
$email->trigger( $order->get_id(), $order );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,12 +65,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
|
|||
*
|
||||
* @param int|WC_Order $order
|
||||
*/
|
||||
public function trigger( $order ) {
|
||||
|
||||
if ( ! is_object( $order ) ) {
|
||||
$order = wc_get_order( absint( $order ) );
|
||||
}
|
||||
|
||||
public function trigger( $order_id, $order ) {
|
||||
if ( $order ) {
|
||||
$this->object = $order;
|
||||
$this->recipient = $this->object->get_billing_email();
|
||||
|
|
Loading…
Reference in New Issue