WordPress at Your Fingertips
function is not described

WC_Cart::has_discount() public WC 1.0

Returns whether or not a discount has been applied.

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

No Hooks.

Return

true|false.

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->has_discount( $coupon_code );
$coupon_code(string)
Coupon code to check.
Default: ''

Code of WC_Cart::has_discount() WC 5.6.0

public function has_discount( $coupon_code = '' ) {
	return $coupon_code ? in_array( wc_format_coupon_code( $coupon_code ), $this->applied_coupons, true ) : count( $this->applied_coupons ) > 0;
}