WordPress at Your Fingertips
function is not described

WC_Download_Handler::download_file_force() public WC 1.0

Force download - this is the default method.

{} It's a method of the class: WC_Download_Handler{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Download_Handler::download_file_force( $file_path, $filename );
$file_path(string) (required)
File path.
$filename(string) (required)
File name.

Code of WC_Download_Handler::download_file_force() WC 5.7.1

public static function download_file_force( $file_path, $filename ) {
	$parsed_file_path = self::parse_file_path( $file_path );
	$download_range   = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // @codingStandardsIgnoreLine.

	self::download_headers( $parsed_file_path['file_path'], $filename, $download_range );

	$start  = isset( $download_range['start'] ) ? $download_range['start'] : 0;
	$length = isset( $download_range['length'] ) ? $download_range['length'] : 0;
	if ( ! self::readfile_chunked( $parsed_file_path['file_path'], $start, $length ) ) {
		if ( $parsed_file_path['remote_file'] && 'yes' === get_option( 'woocommerce_downloads_redirect_fallback_allowed' ) ) {
			wc_get_logger()->warning(
				sprintf(
					/* translators: %1$s contains the filepath of the digital asset. */
					__( '%1$s could not be served using the Force Download method. A redirect will be used instead.', 'woocommerce' ),
					$file_path
				)
			);
			self::download_file_redirect( $file_path );
		} else {
			self::download_error( __( 'File not found', 'woocommerce' ) );
		}
	}

	exit;
}