| @@ 772-785 (lines=14) @@ | ||
| 769 | * @param integer $msg_code |
|
| 770 | * @return string| Message/error string |
|
| 771 | */ |
|
| 772 | public function get_coupon_message( $msg_code ) { |
|
| 773 | switch ( $msg_code ) { |
|
| 774 | case self::WC_COUPON_SUCCESS : |
|
| 775 | $msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
|
| 776 | break; |
|
| 777 | case self::WC_COUPON_REMOVED : |
|
| 778 | $msg = __( 'Coupon code removed successfully.', 'woocommerce' ); |
|
| 779 | break; |
|
| 780 | default: |
|
| 781 | $msg = ''; |
|
| 782 | break; |
|
| 783 | } |
|
| 784 | return apply_filters( 'woocommerce_coupon_message', $msg, $msg_code, $this ); |
|
| 785 | } |
|
| 786 | ||
| 787 | /** |
|
| 788 | * Map one of the WC_Coupon error codes to a message string. |
|
| @@ 878-892 (lines=15) @@ | ||
| 875 | * @param int $err_code Error code |
|
| 876 | * @return string| Error string |
|
| 877 | */ |
|
| 878 | public static function get_generic_coupon_error( $err_code ) { |
|
| 879 | switch ( $err_code ) { |
|
| 880 | case self::E_WC_COUPON_NOT_EXIST: |
|
| 881 | $err = __( 'Coupon does not exist!', 'woocommerce' ); |
|
| 882 | break; |
|
| 883 | case self::E_WC_COUPON_PLEASE_ENTER: |
|
| 884 | $err = __( 'Please enter a coupon code.', 'woocommerce' ); |
|
| 885 | break; |
|
| 886 | default: |
|
| 887 | $err = ''; |
|
| 888 | break; |
|
| 889 | } |
|
| 890 | // When using this static method, there is no $this to pass to filter |
|
| 891 | return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null ); |
|
| 892 | } |
|
| 893 | } |
|
| 894 | ||