In WooCommerce, how to remove $this->validate_product_categories(); in is_valid function in WooCommerce class-wc-coupon.php file without editing plugin?

Is there any hook for to do that in functions.php?

Here is the source code of class-wc-coupon.php:

     * Check if a coupon is valid.
     * @return boolean validity
     * @throws Exception
    public function is_valid() {
        try {

            if ( ! apply_filters( 'woocommerce_coupon_is_valid', true, $this ) ) {
                throw new Exception( self::E_WC_COUPON_INVALID_FILTERED );
        } catch ( Exception $e ) {
            echo $this->error_message = $this->get_coupon_error( $e->getMessage() );
            return false;

        return true;


Read more here: Bypass validate_product_categories() in is_valid function core code for Class WC_Coupon


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: