WC_Product::has_file()publicWC 1.6.2

Check if downloadable product has a file attached.

Method of the class: WC_Product{}

No Hooks.

Return

true|false. Whether downloadable product has a file attached.

Usage

$WC_Product = new WC_Product();
$WC_Product->has_file( $download_id );
$download_id(string)
file identifier.
Default: ''

Changelog

Since 1.6.2 Introduced.

WC_Product::has_file() code WC 8.7.0

public function has_file( $download_id = '' ) {
	return $this->is_downloadable() && $this->get_file( $download_id );
}