woocommerce_file_download_path filter-hookWC 2.1.0

Filter for the path of the downloadable file.

Usage

add_filter( 'woocommerce_file_download_path', 'wp_kama_woocommerce_file_download_path_filter', 10, 3 );

/**
 * Function for `woocommerce_file_download_path` filter-hook.
 * 
 * @param string     $file    The file path.
 * @param WC_Product $product The product object.
 * @param string     $key     The download key.
 *
 * @return string
 */
function wp_kama_woocommerce_file_download_path_filter( $file, $product, $key ){

	// filter...
	return $file;
}
$file(string)
The file path.
$product(WC_Product)
The product object.
$key(string)
The download key.

Changelog

Since 2.1.0 Introduced.

Where the hook is called

WC_Product_Data_Store_CPT::read_downloads()
woocommerce_file_download_path
WC_REST_Products_V1_Controller::save_downloadable_files()
woocommerce_file_download_path
WC_REST_Products_V2_Controller::save_downloadable_files()
woocommerce_file_download_path
woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php 680
$download->set_file( apply_filters( 'woocommerce_file_download_path', $meta_value['file'], $product, $key ) );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 972
$download->set_file( apply_filters( 'woocommerce_file_download_path', $file['file'], $product, $key ) );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 1590
$download->set_file( apply_filters( 'woocommerce_file_download_path', $file['file'], $product, $key ) );

Where the hook is used in WooCommerce

Usage not found.