@@ 783-796 (lines=14) @@ | ||
780 | * @param integer $msg_code |
|
781 | * @return string| Message/error string |
|
782 | */ |
|
783 | public function get_coupon_message( $msg_code ) { |
|
784 | switch ( $msg_code ) { |
|
785 | case self::WC_COUPON_SUCCESS : |
|
786 | $msg = __( 'Coupon code applied successfully.', 'woocommerce' ); |
|
787 | break; |
|
788 | case self::WC_COUPON_REMOVED : |
|
789 | $msg = __( 'Coupon code removed successfully.', 'woocommerce' ); |
|
790 | break; |
|
791 | default: |
|
792 | $msg = ''; |
|
793 | break; |
|
794 | } |
|
795 | return apply_filters( 'woocommerce_coupon_message', $msg, $msg_code, $this ); |
|
796 | } |
|
797 | ||
798 | /** |
|
799 | * Map one of the WC_Coupon error codes to a message string. |
|
@@ 889-903 (lines=15) @@ | ||
886 | * @param int $err_code Error code |
|
887 | * @return string| Error string |
|
888 | */ |
|
889 | public static function get_generic_coupon_error( $err_code ) { |
|
890 | switch ( $err_code ) { |
|
891 | case self::E_WC_COUPON_NOT_EXIST: |
|
892 | $err = __( 'Coupon does not exist!', 'woocommerce' ); |
|
893 | break; |
|
894 | case self::E_WC_COUPON_PLEASE_ENTER: |
|
895 | $err = __( 'Please enter a coupon code.', 'woocommerce' ); |
|
896 | break; |
|
897 | default: |
|
898 | $err = ''; |
|
899 | break; |
|
900 | } |
|
901 | // When using this static method, there is no $this to pass to filter |
|
902 | return apply_filters( 'woocommerce_coupon_error', $err, $err_code, null ); |
|
903 | } |
|
904 | } |
|
905 |