WC_Download_Handler::check_download_expiry()private staticWC 1.0

Check if the download has expired.

Method of the class: WC_Download_Handler{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Download_Handler::check_download_expiry( $download );
$download(WC_Customer_Download) (required)
Download instance.

WC_Download_Handler::check_download_expiry() code WC 9.4.2

private static function check_download_expiry( $download ) {
	if ( ! is_null( $download->get_access_expires() ) && $download->get_access_expires()->getTimestamp() < strtotime( 'midnight', time() ) ) {
		self::download_error( __( 'Sorry, this download has expired', 'woocommerce' ), '', 403 );
	}
}