diff --git a/classes/class-wc-customer.php b/classes/class-wc-customer.php
index b386a70909c..75d478e3f2e 100644
--- a/classes/class-wc-customer.php
+++ b/classes/class-wc-customer.php
@@ -589,7 +589,7 @@ class WC_Customer {
}
// order exists and downloads permitted?
- if ( ! $order->id || ! $order->is_download_permitted() ) continue;
+ if ( ! $order->id || ! $order->is_download_permitted() || $order->status != 'publish' ) continue;
if ( ! $_product || $_product->id != $result->product_id ) :
// new product
diff --git a/templates/order/order-details.php b/templates/order/order-details.php
index 43c1914b40c..f47ea22c87b 100755
--- a/templates/order/order-details.php
+++ b/templates/order/order-details.php
@@ -53,10 +53,10 @@ $order = new WC_Order( $order_id );
if ( $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted() ) :
- $download_file_urls = $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item );
- foreach ( $download_file_urls as $i => $download_file_url ) :
- echo '
' . sprintf( __( 'Download file %s →', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '';
- endforeach;
+ $download_file_urls = $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item );
+ foreach ( $download_file_urls as $i => $download_file_url ) :
+ echo '
' . sprintf( __( 'Download file %s →', 'woocommerce' ), ( count( $download_file_urls ) > 1 ? $i + 1 : '' ) ) . '';
+ endforeach;
endif;
diff --git a/woocommerce-functions.php b/woocommerce-functions.php
index bae3ad84f31..b2820715ee3 100644
--- a/woocommerce-functions.php
+++ b/woocommerce-functions.php
@@ -903,7 +903,7 @@ function woocommerce_download_product() {
if ( $order_id ) {
$order = new WC_Order( $order_id );
- if ( ! $order->is_download_permitted() && $order->status != 'publish' )
+ if ( ! $order->is_download_permitted() || $order->status != 'publish' )
wp_die( __( 'Invalid order.', 'woocommerce' ) . ' ' . __( 'Go to homepage →', 'woocommerce' ) . '' );
}