WC_Coupon::get_generic_coupon_error
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.
Метод класса: WC_Coupon{}
Хуки из метода
Возвращает
Строку. Error string.
Использование
$result = WC_Coupon::get_generic_coupon_error( $err_code );
- $err_code(int) (обязательный)
- Error code.
Код WC_Coupon::get_generic_coupon_error() WC Coupon::get generic coupon error WC 10.6.2
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 );
}