WC_Coupon::get_generic_coupon_error( int $err_code )
Map one of the WC_Coupon error codes to an error string.
Description Description
No coupon instance will be available where a coupon does not exist, so this static method exists.
Parameters Parameters
- $err_code
-
(Required) Error code.
Return Return
(string) Error string.
Source Source
File: includes/class-wc-coupon.php
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 ); }