|
@@ 1268-1281 (lines=14) @@
|
| 1265 |
|
* @param integer $msg_code |
| 1266 |
|
* @return string| Message/error string |
| 1267 |
|
*/ |
| 1268 |
|
public function get_coupon_message( $msg_code ) { |
| 1269 |
|
switch ( $msg_code ) { |
| 1270 |
|
case self::WC_COUPON_SUCCESS : |
| 1271 |
|
$msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
| 1272 |
|
break; |
| 1273 |
|
case self::WC_COUPON_REMOVED : |
| 1274 |
|
$msg = __( 'Coupon code removed successfully.', 'woocommerce' ); |
| 1275 |
|
break; |
| 1276 |
|
default: |
| 1277 |
|
$msg = ''; |
| 1278 |
|
break; |
| 1279 |
|
} |
| 1280 |
|
return apply_filters( 'woocommerce_coupon_message', $msg, $msg_code, $this ); |
| 1281 |
|
} |
| 1282 |
|
|
| 1283 |
|
/** |
| 1284 |
|
* Map one of the WC_Coupon error codes to a message string. |
|
@@ 1374-1388 (lines=15) @@
|
| 1371 |
|
* @param int $err_code Error code |
| 1372 |
|
* @return string| Error string |
| 1373 |
|
*/ |
| 1374 |
|
public static function get_generic_coupon_error( $err_code ) { |
| 1375 |
|
switch ( $err_code ) { |
| 1376 |
|
case self::E_WC_COUPON_NOT_EXIST: |
| 1377 |
|
$err = __( 'Coupon does not exist!', 'woocommerce' ); |
| 1378 |
|
break; |
| 1379 |
|
case self::E_WC_COUPON_PLEASE_ENTER: |
| 1380 |
|
$err = __( 'Please enter a coupon code.', 'woocommerce' ); |
| 1381 |
|
break; |
| 1382 |
|
default: |
| 1383 |
|
$err = ''; |
| 1384 |
|
break; |
| 1385 |
|
} |
| 1386 |
|
// When using this static method, there is no $this to pass to filter |
| 1387 |
|
return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null ); |
| 1388 |
|
} |
| 1389 |
|
} |
| 1390 |
|
|