Check if order exists before create downloads hash

This commit is contained in:
Claudio Sanches 2019-08-12 12:18:35 -03:00
parent 5b9b67ace1
commit 8ef99cf1de
1 changed files with 1 additions and 1 deletions

View File

@ -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(