public static function download($file_path, $product_id)
{
if (!$file_path) {
self::download_error(__('No file defined', 'woocommerce'));
}
$filename = basename($file_path);
if (strstr($filename, '?')) {
$filename = current(explode('?', $filename));
}
$filename = apply_filters('woocommerce_file_download_filename', $filename, $product_id);
$file_download_method = apply_filters('woocommerce_file_download_method', get_option('woocommerce_file_download_method', 'force'), $product_id);
// Add action to prevent issues in IE
add_action('nocache_headers', array(__CLASS__, 'ie_nocache_headers_fix'));
// Trigger download via one of the methods
do_action('woocommerce_download_file_' . $file_download_method, $file_path, $filename);
}