From 17b18ac68f850bbcb573b0d72e4ec3b9c5c0502e Mon Sep 17 00:00:00 2001 From: Ovidiu Liuta Date: Tue, 22 Mar 2022 14:26:41 +0200 Subject: [PATCH] adding woocommerce_download_parse_file_path filter --- plugins/woocommerce/includes/class-wc-download-handler.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce/includes/class-wc-download-handler.php b/plugins/woocommerce/includes/class-wc-download-handler.php index 97f0961fed5..be4cd66fb21 100644 --- a/plugins/woocommerce/includes/class-wc-download-handler.php +++ b/plugins/woocommerce/includes/class-wc-download-handler.php @@ -276,9 +276,10 @@ class WC_Download_Handler { // Paths that begin with '//' are always remote URLs. if ( '//' === substr( $file_path, 0, 2 ) ) { + $file_path = (is_ssl() ? 'https:' : 'http:') . $file_path; return array( 'remote_file' => true, - 'file_path' => is_ssl() ? 'https:' . $file_path : 'http:' . $file_path, + 'file_path' => apply_filters( 'woocommerce_download_parse_file_path', $file_path, true ), ); } @@ -299,7 +300,7 @@ class WC_Download_Handler { return array( 'remote_file' => $remote_file, - 'file_path' => $file_path, + 'file_path' => apply_filters( 'woocommerce_download_parse_file_path', $file_path, $remote_file ) ); }