WooCommerce allows you to define download expiration (in days) e.g. how many days after an order is made the user is allowed to download the purchased product's file(s). This is a good mechanism to prevent people from downloading the file long after the order is made.

If you need to get the download expiration days you can use the following snippet.

[code]
$product_id = 123;
$limit      = trim( get_post_meta( $product_id, '_download_expiry', true ) );
[/code]
This snippet is from function: wc_downloadable_file_permission found in file: plugins/woocommerce/includes/wc-order-functions.php

Referral Note: When you purchase through an referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer