通过过滤器自定义WooCommerce请求报价消息

I am trying to customise WooCommerce Request-a-quote plugin, and i cannot get a filter to change. This plugin uses JS Ajax, as well as PHP reload.

This is the code in the plugin file class, which is not within the templates folder:

if ( $return == 'true' ) {
            $message = apply_filters( 'yith_ywraq_product_added_to_list_message', __( 'Product added!', 'yith-woocommerce-request-a-quote' ) );
        }
        elseif ( $return == 'exists' ) {
            $message = apply_filters( 'yith_ywraq_product_already_in_list_message', __( 'Product already in the list.', 'yith-woocommerce-request-a-quote' ) );
        }
        elseif ( count( $errors ) > 0 ) {
            $message = apply_filters( 'yith_ywraq_error_adding_to_list_message', $this->get_errors($errors) );
        }

In the theme function.php, I have put this:

function change_message() {
    $message = 'Enquiry Added!';
    echo apply_filters( 'yith_ywraq_product_already_in_list_message', $message );
}
add_filter('yith_ywraq_error_adding_to_list_message', 'change_message');

But i cannot make it change the text, it remains the same. I do not see what I am missing, can anyone point to it ?

Thanks in advance.

Addy

You were not to far away, you need to return $message,

 function change_message() {
    $message = 'Enquiry Added!';

    return $message;
 }

 add_filter('yith_ywraq_error_adding_to_list_message', 'change_message');

Note with this action, you will only change the error message.