From 8ef99cf1de438cabc09109799607f36863ccde1f Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 12 Aug 2019 12:18:35 -0300 Subject: [PATCH] Check if order exists before create downloads hash --- includes/class-wc-order-item-product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-order-item-product.php b/includes/class-wc-order-item-product.php index fe8fdef7067..718fe3344b7 100644 --- a/includes/class-wc-order-item-product.php +++ b/includes/class-wc-order-item-product.php @@ -368,9 +368,9 @@ class WC_Order_Item_Product extends WC_Order_Item { $product = $this->get_product(); $order = $this->get_order(); $product_id = $this->get_variation_id() ? $this->get_variation_id() : $this->get_product_id(); - $email_hash = function_exists( 'hash' ) ? hash( 'sha256', $order->get_billing_email() ) : sha1( $order->get_billing_email() ); if ( $product && $order && $product->is_downloadable() && $order->is_download_permitted() ) { + $email_hash = function_exists( 'hash' ) ? hash( 'sha256', $order->get_billing_email() ) : sha1( $order->get_billing_email() ); $data_store = WC_Data_Store::load( 'customer-download' ); $customer_downloads = $data_store->get_downloads( array(