WC_Discounts::validate_coupon_expiry_date()
Ensure coupon date is valid or throw exception.
Method of the class: WC_Discounts{}
Hooks from the method
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. |
WC_Discounts::validate_coupon_expiry_date() WC Discounts::validate coupon expiry date code WC 9.6.1
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; }