Automattic\WooCommerce\StoreApi\Schemas\V1

CartCouponSchema::coupon_exists()publicWC 1.0

Check given coupon exists.

Method of the class: CartCouponSchema{}

No Hooks.

Return

true|false.

Usage

$CartCouponSchema = new CartCouponSchema();
$CartCouponSchema->coupon_exists( $coupon_code );
$coupon_code(string) (required)
Coupon code.

CartCouponSchema::coupon_exists() code WC 8.6.1

public function coupon_exists( $coupon_code ) {
	$coupon = new \WC_Coupon( $coupon_code );
	return (bool) $coupon->get_id() || $coupon->get_virtual();
}