WC_Discounts::validate_coupon_exists( WC_Coupon $coupon )

Ensure coupon exists or throw exception.


Description Description


Parameters Parameters

$coupon

(Required) Coupon data.


Top ↑

Return Return

(bool)


Top ↑

Source Source

File: includes/class-wc-discounts.php

	protected function validate_coupon_exists( $coupon ) {
		if ( ! $coupon->get_id() && ! $coupon->get_virtual() ) {
			/* translators: %s: coupon code */
			throw new Exception( sprintf( __( 'Coupon "%s" does not exist!', 'woocommerce' ), esc_html( $coupon->get_code() ) ), 105 );
		}

		return true;
	}

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.