Automattic\WooCommerce\Internal\Admin\Notes

CouponPageMoved::can_be_added()public staticWC 1.0

Checks if a note can and should be added.

Method of the class: CouponPageMoved{}

No Hooks.

Return

true|false.

Usage

$result = CouponPageMoved::can_be_added();

CouponPageMoved::can_be_added() code WC 7.1.0

public static function can_be_added() {
	if ( ! wc_coupons_enabled() ) {
		return false;
	}

	// Don't add the notice if the legacy coupon menu is already disabled.
	if ( ! self::should_display_legacy_menu() ) {
		return false;
	}

	// Don't add the notice if it's been hidden by the user before.
	if ( self::has_dismissed_note() ) {
		return false;
	}

	// If we already have a notice, don't add a new one.
	if ( self::has_unactioned_note() ) {
		return false;
	}

	return isset( $_GET[ self::$query_key ] ) && (bool) $_GET[ self::$query_key ]; // phpcs:ignore WordPress.Security.NonceVerification
}