From 4c6641ab6a38cc5283de1c679a59a3f5a1c62809 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Thu, 29 Mar 2018 13:58:40 -0300 Subject: [PATCH] Adds new hook to allow customize downlodable file permissions This is needed on Product Custom Tables in order to allow control expire and remaining downloads per file. --- includes/wc-order-functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/wc-order-functions.php b/includes/wc-order-functions.php index e4073be5a86..f9aedea7697 100644 --- a/includes/wc-order-functions.php +++ b/includes/wc-order-functions.php @@ -366,6 +366,8 @@ function wc_downloadable_file_permission( $download_id, $product, $order, $qty = $download->set_access_expires( strtotime( $from_date . ' + ' . $expiry . ' DAY' ) ); } + $download = apply_filters( 'woocommerce_downloadable_file_permission', $download, $product, $order, $qty ); + return $download->save(); }