WordPress at Your Fingertips
function is not described

WC_Coupon::get_generic_coupon_error() public WC 1.0

Map one of the WC_Coupon error codes to an error string. No coupon instance will be available where a coupon does not exist, so this static method exists.

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

Hooks from the method
Return

String. Error string.

Usage

$result = WC_Coupon::get_generic_coupon_error( $err_code );
$err_code(int) (required)
Error code.

Code of WC_Coupon::get_generic_coupon_error() WC 5.7.1

public static function get_generic_coupon_error( $err_code ) {
	switch ( $err_code ) {
		case self::E_WC_COUPON_NOT_EXIST:
			$err = __( 'Coupon does not exist!', 'woocommerce' );
			break;
		case self::E_WC_COUPON_PLEASE_ENTER:
			$err = __( 'Please enter a coupon code.', 'woocommerce' );
			break;
		default:
			$err = '';
			break;
	}
	// When using this static method, there is no $this to pass to filter.
	return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null );
}