WC_Discounts::validate_coupon_expiry_date()protectedWC 3.2.0

Ensure coupon date is valid or throw exception.

Метод класса: WC_Discounts{}

Хуки из метода

Возвращает

true|false.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->validate_coupon_expiry_date( $coupon );
$coupon(WC_Coupon) (обязательный)
Coupon data.

Список изменений

С версии 3.2.0 Введена.

Код WC_Discounts::validate_coupon_expiry_date() WC 8.7.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;
}