Warning: This method has been deprecated. In favor of WC_Discounts->is_coupon_valid instead.

WC_Coupon::is_valid()

Check if a coupon is valid for the cart.


Description Description


Return Return

(bool)


Top ↑

Source Source

File: includes/class-wc-coupon.php

	public function is_valid() {
		$discounts = new WC_Discounts( WC()->cart );
		$valid     = $discounts->is_coupon_valid( $this );

		if ( is_wp_error( $valid ) ) {
			$this->error_message = $valid->get_error_message();
			return false;
		}

		return $valid;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.