WooCommerce Notice Messages, how do I edit them?

前端 未结 5 1482
别那么骄傲
别那么骄傲 2021-02-01 05:40

I\'m trying to figure out where WooCommerce creates it\'s messages for when there is a success, error or notice in WooCommerce. I want to edit those messages to fit the scenario

5条回答
  •  借酒劲吻你
    2021-02-01 06:11

    I came across this answer and was able to implement for a production site. This answer is related to woocommerce error codes notices. You need to find the codes in the separate class files (~woocommerce/includes/). For my purpose the code was in ~woocommerce/includes/class-wc-coupon.php

    /**
     * Modify the coupon errors:
    */
    
     add_filter( 'woocommerce_coupon_error', 'wpq_coupon_error', 10, 2 );
    
     function wpq_coupon_error( $err, $err_code ) {
      return ( '103' == $err_code ) ? '' : $err;
     }
    

    Thanks to this page: http://wpquestions.com/WooCommerce_Remove_Coupon_code_already_applied_error_message/10598

提交回复
热议问题