WC_Discounts::validate_coupon_expiry_date
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 Discounts::validate coupon expiry date WC 10.4.3
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(
sprintf(
/* translators: %s: coupon code */
esc_html__( 'Coupon "%s" has expired.', 'woocommerce' ),
esc_html( $coupon->get_code() )
),
107
);
}
return true;
}