Billing email must be set to grant permission. #2555
This commit is contained in:
parent
4913a09e54
commit
4918d7a27d
|
@ -122,7 +122,7 @@ function woocommerce_order_downloads_meta_box() {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
alert('<?php _e( 'Could not grant access - the user may already have permission for this file.', 'woocommerce' ); ?>');
|
alert('<?php _e( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ); ?>');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -875,6 +875,9 @@ function woocommerce_grant_access_to_download() {
|
||||||
|
|
||||||
$user_email = sanitize_email( $order->billing_email );
|
$user_email = sanitize_email( $order->billing_email );
|
||||||
|
|
||||||
|
if ( ! $user_email )
|
||||||
|
die();
|
||||||
|
|
||||||
$limit = trim( get_post_meta( $product_id, '_download_limit', true ) );
|
$limit = trim( get_post_meta( $product_id, '_download_limit', true ) );
|
||||||
$expiry = trim( get_post_meta( $product_id, '_download_expiry', true ) );
|
$expiry = trim( get_post_meta( $product_id, '_download_expiry', true ) );
|
||||||
$file_paths = apply_filters( 'woocommerce_file_download_paths', get_post_meta( $product_id, '_file_paths', true ), $product_id, $order_id, null );
|
$file_paths = apply_filters( 'woocommerce_file_download_paths', get_post_meta( $product_id, '_file_paths', true ), $product_id, $order_id, null );
|
||||||
|
|
Loading…
Reference in New Issue