Expiry date calculation based on order completion date

This commit is contained in:
Ratnakar 2013-12-17 10:37:19 +05:30
parent 3bd2d0d456
commit 0faf26cbd2
1 changed files with 4 additions and 2 deletions

View File

@ -52,8 +52,10 @@ function wc_downloadable_file_permission( $download_id, $product_id, $order ) {
// Default value is NULL in the table schema
$expiry = empty( $expiry ) ? null : absint( $expiry );
if ( $expiry )
$expiry = date_i18n( "Y-m-d", strtotime( 'NOW + ' . $expiry . ' DAY' ) );
if ( $expiry ) {
$order_completed_date = date_i18n( "Y-m-d", strtotime( $order->completed_date ) );
$expiry = date_i18n( "Y-m-d", strtotime( $order_completed_date . ' + ' . $expiry . ' DAY' ) );
}
$data = apply_filters( 'woocommerce_downloadable_file_permission_data', array(
'download_id' => $download_id,