Check we have a WC_Order during email events
This commit is contained in:
parent
f5a36778fd
commit
f2990b0c7d
|
@ -366,12 +366,15 @@ class WC_Emails {
|
||||||
/**
|
/**
|
||||||
* Add customer details to email templates.
|
* Add customer details to email templates.
|
||||||
*
|
*
|
||||||
* @param mixed $order
|
* @param WC_Order $order
|
||||||
* @param bool $sent_to_admin (default: false)
|
* @param bool $sent_to_admin (default: false)
|
||||||
* @param bool $plain_text (default: false)
|
* @param bool $plain_text (default: false)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function customer_details( $order, $sent_to_admin = false, $plain_text = false ) {
|
public function customer_details( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||||
|
if ( ! is_a( 'WC_Order', $order ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$fields = array();
|
$fields = array();
|
||||||
|
|
||||||
if ( $order->get_customer_note() ) {
|
if ( $order->get_customer_note() ) {
|
||||||
|
@ -408,6 +411,9 @@ class WC_Emails {
|
||||||
* Get the email addresses.
|
* Get the email addresses.
|
||||||
*/
|
*/
|
||||||
public function email_addresses( $order, $sent_to_admin = false, $plain_text = false ) {
|
public function email_addresses( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||||
|
if ( ! is_a( 'WC_Order', $order ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ( $plain_text ) {
|
if ( $plain_text ) {
|
||||||
wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) );
|
wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -328,7 +328,7 @@ class WC_Structured_Data {
|
||||||
* @param bool $plain_text Plain text email (default: false).
|
* @param bool $plain_text Plain text email (default: false).
|
||||||
*/
|
*/
|
||||||
public function generate_order_data( $order, $sent_to_admin = false, $plain_text = false ) {
|
public function generate_order_data( $order, $sent_to_admin = false, $plain_text = false ) {
|
||||||
if ( $plain_text ) {
|
if ( $plain_text || ! is_a( $order, 'WC_Order' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue