woocommerce_download_product_filepath filter-hookWC 4.0.0

Filter download filepath.

Usage

add_filter( 'woocommerce_download_product_filepath', 'wp_kama_woocommerce_download_product_filepath_filter', 10, 5 );

/**
 * Function for `woocommerce_download_product_filepath` filter-hook.
 * 
 * @param string               $file_path     File path.
 * @param string               $email_address Email address.
 * @param WC_Order|bool        $order         Order object or false.
 * @param WC_Product           $product       Product object.
 * @param WC_Customer_Download $download      Download data.
 *
 * @return string
 */
function wp_kama_woocommerce_download_product_filepath_filter( $file_path, $email_address, $order, $product, $download ){

	// filter...
	return $file_path;
}
$file_path(string)
File path.
$email_address(string)
Email address.
$order(WC_Order|true|false)
Order object or false.
$product(WC_Product)
Product object.
$download(WC_Customer_Download)
Download data.

Changelog

Since 4.0.0 Introduced.

Where the hook is called

WC_Download_Handler::download_product()
woocommerce_download_product_filepath
woocommerce/includes/class-wc-download-handler.php 112-119
$file_path = apply_filters(
	'woocommerce_download_product_filepath',
	$product->get_file_download_path( $download->get_download_id() ),
	$email_address,
	$order,
	$product,
	$download
);

Where the hook is used in WooCommerce

Usage not found.