WordPress at Your Fingertips
function is not described

WC_Discounts::validate_coupon_expiry_date() protected WC 3.2.0

Ensure coupon date is valid or throw exception.

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

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->validate_coupon_expiry_date( $coupon );
$coupon(WC_Coupon) (required)
Coupon data.

Changelog

Since 3.2.0 Introduced.

Code of WC_Discounts::validate_coupon_expiry_date() WC 5.6.0

protected function validate_coupon_expiry_date( $coupon ) {
	if ( $coupon->get_date_expires() && apply_filters( 'woocommerce_coupon_validate_expiry_date', time() > $coupon->get_date_expires()->getTimestamp(), $coupon, $this ) ) {
		throw new Exception( __( 'This coupon has expired.', 'woocommerce' ), 107 );
	}

	return true;
}