|
@@ 1285-1298 (lines=14) @@
|
| 1282 |
|
* @param integer $msg_code |
| 1283 |
|
* @return string| Message/error string |
| 1284 |
|
*/ |
| 1285 |
|
public function get_coupon_message( $msg_code ) { |
| 1286 |
|
switch ( $msg_code ) { |
| 1287 |
|
case self::WC_COUPON_SUCCESS : |
| 1288 |
|
$msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
| 1289 |
|
break; |
| 1290 |
|
case self::WC_COUPON_REMOVED : |
| 1291 |
|
$msg = __( 'Coupon code removed successfully.', 'woocommerce' ); |
| 1292 |
|
break; |
| 1293 |
|
default: |
| 1294 |
|
$msg = ''; |
| 1295 |
|
break; |
| 1296 |
|
} |
| 1297 |
|
return apply_filters( 'woocommerce_coupon_message', $msg, $msg_code, $this ); |
| 1298 |
|
} |
| 1299 |
|
|
| 1300 |
|
/** |
| 1301 |
|
* Map one of the WC_Coupon error codes to a message string. |
|
@@ 1391-1405 (lines=15) @@
|
| 1388 |
|
* @param int $err_code Error code |
| 1389 |
|
* @return string| Error string |
| 1390 |
|
*/ |
| 1391 |
|
public static function get_generic_coupon_error( $err_code ) { |
| 1392 |
|
switch ( $err_code ) { |
| 1393 |
|
case self::E_WC_COUPON_NOT_EXIST: |
| 1394 |
|
$err = __( 'Coupon does not exist!', 'woocommerce' ); |
| 1395 |
|
break; |
| 1396 |
|
case self::E_WC_COUPON_PLEASE_ENTER: |
| 1397 |
|
$err = __( 'Please enter a coupon code.', 'woocommerce' ); |
| 1398 |
|
break; |
| 1399 |
|
default: |
| 1400 |
|
$err = ''; |
| 1401 |
|
break; |
| 1402 |
|
} |
| 1403 |
|
// When using this static method, there is no $this to pass to filter |
| 1404 |
|
return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null ); |
| 1405 |
|
} |
| 1406 |
|
} |
| 1407 |
|
|