woocommerce_file_download_method filter-hookWC 4.5.0

Filter download method.

Usage

add_filter( 'woocommerce_file_download_method', 'wp_kama_woocommerce_file_download_method_filter', 10, 3 );

/**
 * Function for `woocommerce_file_download_method` filter-hook.
 * 
 * @param string $method     Download method.
 * @param int    $product_id Product ID.
 * @param string $file_path  URL to file.
 *
 * @return string
 */
function wp_kama_woocommerce_file_download_method_filter( $method, $product_id, $file_path ){

	// filter...
	return $method;
}
$method(string)
Download method.
$product_id(int)
Product ID.
$file_path(string)
URL to file.

Changelog

Since 4.5.0 Introduced.

Where the hook is called

WC_Download_Handler::download()
woocommerce_file_download_method
woocommerce/includes/class-wc-download-handler.php 239
$file_download_method = apply_filters( 'woocommerce_file_download_method', get_option( 'woocommerce_file_download_method', 'force' ), $product_id, $file_path );

Where the hook is used in WooCommerce

Usage not found.