|
@@ 1219-1232 (lines=14) @@
|
| 1216 |
|
* @param integer $msg_code |
| 1217 |
|
* @return string| Message/error string |
| 1218 |
|
*/ |
| 1219 |
|
public function get_coupon_message( $msg_code ) { |
| 1220 |
|
switch ( $msg_code ) { |
| 1221 |
|
case self::WC_COUPON_SUCCESS : |
| 1222 |
|
$msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
| 1223 |
|
break; |
| 1224 |
|
case self::WC_COUPON_REMOVED : |
| 1225 |
|
$msg = __( 'Coupon code removed successfully.', 'woocommerce' ); |
| 1226 |
|
break; |
| 1227 |
|
default: |
| 1228 |
|
$msg = ''; |
| 1229 |
|
break; |
| 1230 |
|
} |
| 1231 |
|
return apply_filters( 'woocommerce_coupon_message', $msg, $msg_code, $this ); |
| 1232 |
|
} |
| 1233 |
|
|
| 1234 |
|
/** |
| 1235 |
|
* Map one of the WC_Coupon error codes to a message string. |
|
@@ 1325-1339 (lines=15) @@
|
| 1322 |
|
* @param int $err_code Error code |
| 1323 |
|
* @return string| Error string |
| 1324 |
|
*/ |
| 1325 |
|
public static function get_generic_coupon_error( $err_code ) { |
| 1326 |
|
switch ( $err_code ) { |
| 1327 |
|
case self::E_WC_COUPON_NOT_EXIST: |
| 1328 |
|
$err = __( 'Coupon does not exist!', 'woocommerce' ); |
| 1329 |
|
break; |
| 1330 |
|
case self::E_WC_COUPON_PLEASE_ENTER: |
| 1331 |
|
$err = __( 'Please enter a coupon code.', 'woocommerce' ); |
| 1332 |
|
break; |
| 1333 |
|
default: |
| 1334 |
|
$err = ''; |
| 1335 |
|
break; |
| 1336 |
|
} |
| 1337 |
|
// When using this static method, there is no $this to pass to filter |
| 1338 |
|
return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null ); |
| 1339 |
|
} |
| 1340 |
|
} |
| 1341 |
|
|