From 888622a621d7f1955173921006dec0fc911a3c6d Mon Sep 17 00:00:00 2001 From: Bryce Date: Thu, 5 Feb 2015 12:55:33 +0700 Subject: [PATCH] Fix fatal error on /my-account/view-order/ endpoint When no order number is set this causes a fatal error. This check for the $order object should be sufficient. Closes #7301 --- includes/class-wc-query.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-query.php b/includes/class-wc-query.php index b6ebc21dbf8..764e58e2e79 100644 --- a/includes/class-wc-query.php +++ b/includes/class-wc-query.php @@ -3,7 +3,7 @@ * Contains the query functions for WooCommerce which alter the front-end post queries and loops. * * @class WC_Query - * @version 1.6.4 + * @version 2.3.0 * @package WooCommerce/Classes * @category Class * @author WooThemes @@ -113,7 +113,7 @@ class WC_Query { break; case 'view-order' : $order = wc_get_order( $wp->query_vars['view-order'] ); - $title = sprintf( __( 'Order %s', 'woocommerce' ), _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ); + $title = ( $order ) ? sprintf( __( 'Order %s', 'woocommerce' ), _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ) : ''; break; case 'edit-account' : $title = __( 'Edit Account Details', 'woocommerce' );