WC_Download_Handler::check_order_is_valid()private staticWC 1.0

Check if an order is valid for downloading from.

Method of the class: WC_Download_Handler{}

No Hooks.

Return

null. Nothing (null).

Usage

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

WC_Download_Handler::check_order_is_valid() code WC 9.4.2

private static function check_order_is_valid( $download ) {
	if ( $download->get_order_id() ) {
		$order = wc_get_order( $download->get_order_id() );

		if ( $order && ! $order->is_download_permitted() ) {
			self::download_error( __( 'Invalid order.', 'woocommerce' ), '', 403 );
		}
	}
}