Fix error when rendering customer invoice email
When sending a customer their invoice on a non-pending order, I get this error in the logs: PHP Fatal error: Uncaught Error: Using $this when not in object context in wp-content/plugins/woocommerce/templates/emails/plain/customer-invoice.php:37 Stack trace: #0 wp-content/plugins/woocommerce/includes/wc-core-functions.php(208): include() #1 wp-content/plugins/woocommerce/includes/wc-core-functions.php(228): wc_get_template('emails/plain/cu...', Array, '', '') #2 wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-invoice.php(165): wc_get_template_html('emails/plain/cu...', Array) #3 wp-content/plugins/woocommerce/includes/emails/class-wc-email.php(502): WC_Email_Customer_Invoice->get_content_plain() #4 wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-invoice.php(130): WC_Email->get_content() #5 wp-content/plugins/woocommerce/includes/class-wc-emails.php(338): WC_Email_Customer_Invoice->trigger(288402, Object(WC_Order)) #6 wp-content/plugins/woocommerce/templates/emails/plain/customer-invoice.php on line 37 referer: wp-admin/post.php?post=nnnnnn&action=edit Change the "$this->object" reference to "$order" instead.
This commit is contained in:
parent
f39b006264
commit
a0cb6a9166
|
@ -34,7 +34,7 @@ if ( $order->has_status( 'pending' ) ) {
|
|||
|
||||
} else {
|
||||
/* translators: %s Order date */
|
||||
echo sprintf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $this->object->get_date_created() ) ) ) . "\n\n";
|
||||
echo sprintf( esc_html__( 'Here are the details of your order placed on %s:', 'woocommerce' ), esc_html( wc_format_datetime( $order->get_date_created() ) ) ) . "\n\n";
|
||||
}
|
||||
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
|
||||
|
||||
|
|
Loading…
Reference in New Issue