Check if order exists before create downloads hash
This commit is contained in:
parent
5b9b67ace1
commit
8ef99cf1de
|
@ -368,9 +368,9 @@ class WC_Order_Item_Product extends WC_Order_Item {
|
||||||
$product = $this->get_product();
|
$product = $this->get_product();
|
||||||
$order = $this->get_order();
|
$order = $this->get_order();
|
||||||
$product_id = $this->get_variation_id() ? $this->get_variation_id() : $this->get_product_id();
|
$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() ) {
|
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' );
|
$data_store = WC_Data_Store::load( 'customer-download' );
|
||||||
$customer_downloads = $data_store->get_downloads(
|
$customer_downloads = $data_store->get_downloads(
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Reference in New Issue