|
@@ 1207-1220 (lines=14) @@
|
| 1204 |
|
* @param integer $msg_code |
| 1205 |
|
* @return string| Message/error string |
| 1206 |
|
*/ |
| 1207 |
|
public function get_coupon_message( $msg_code ) { |
| 1208 |
|
switch ( $msg_code ) { |
| 1209 |
|
case self::WC_COUPON_SUCCESS : |
| 1210 |
|
$msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
| 1211 |
|
break; |
| 1212 |
|
case self::WC_COUPON_REMOVED : |
| 1213 |
|
$msg = __( 'Coupon code removed successfully.', 'woocommerce' ); |
| 1214 |
|
break; |
| 1215 |
|
default: |
| 1216 |
|
$msg = ''; |
| 1217 |
|
break; |
| 1218 |
|
} |
| 1219 |
|
return apply_filters( 'woocommerce_coupon_message', $msg, $msg_code, $this ); |
| 1220 |
|
} |
| 1221 |
|
|
| 1222 |
|
/** |
| 1223 |
|
* Map one of the WC_Coupon error codes to a message string. |
|
@@ 1313-1327 (lines=15) @@
|
| 1310 |
|
* @param int $err_code Error code |
| 1311 |
|
* @return string| Error string |
| 1312 |
|
*/ |
| 1313 |
|
public static function get_generic_coupon_error( $err_code ) { |
| 1314 |
|
switch ( $err_code ) { |
| 1315 |
|
case self::E_WC_COUPON_NOT_EXIST: |
| 1316 |
|
$err = __( 'Coupon does not exist!', 'woocommerce' ); |
| 1317 |
|
break; |
| 1318 |
|
case self::E_WC_COUPON_PLEASE_ENTER: |
| 1319 |
|
$err = __( 'Please enter a coupon code.', 'woocommerce' ); |
| 1320 |
|
break; |
| 1321 |
|
default: |
| 1322 |
|
$err = ''; |
| 1323 |
|
break; |
| 1324 |
|
} |
| 1325 |
|
// When using this static method, there is no $this to pass to filter |
| 1326 |
|
return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null ); |
| 1327 |
|
} |
| 1328 |
|
} |
| 1329 |
|
|