add filter to change specific part of function
<p>I am trying to remove a class from a button in woocommerce that is in the wc_cart_functions.php file. There is a string in the <code>wc_add_to_cart_message</code> function which inserts this string:</p>

<p><code>&lt;a href="%s" class="button wc-forward"&gt;%s&lt;/a&gt; %s</code></p>

<pre><code>function wc_add_to_cart_message( $products, $show_qty = false ) {
$titles = array();
$count  = 0;

if ( ! is_array( $products ) ) {
    $products = array( $products );
    $show_qty = false;
}

if ( ! $show_qty ) {
    $products = array_fill_keys( array_keys( $products ), 1 );
}

foreach ( $products as $product_id =&gt; $qty ) {
    $titles[] = ( $qty &gt; 1 ? absint( $qty ) . ' &amp;times; ' : '' ) . sprintf( _x( '&amp;ldquo;%s&amp;rdquo;', 'Item name in quotes', 'woocommerce' ), strip_tags( get_the_title( $product_id ) ) );
    $count += $qty;
}

$titles     = array_filter( $titles );
$added_text = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', $count, 'woocommerce' ), wc_format_list_of_items( $titles ) );

// Output success messages
if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
    $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) );
    $message   = sprintf( '&lt;a href="%s" class="button wc-forward"&gt;%s&lt;/a&gt; %s', esc_url( $return_to ), esc_html__( 'Continue Shopping', 'woocommerce' ), esc_html( $added_text ) );
} else {
    $message   = sprintf( '&lt;a href="%s" class="button wc-forward"&gt;%s&lt;/a&gt; %s', esc_url( wc_get_page_permalink( 'cart' ) ), esc_html__( 'View Cart', 'woocommerce' ), esc_html( $added_text ) );
}

wc_add_notice( apply_filters( 'wc_add_to_cart_message', $message, $product_id ) );
}
</code></pre>

<p>I tried to create a filter which would just replace that specific string, since it appears twice and in both instances I want the class removed. This does not seem to work though:</p>

<pre><code>add_filter( 'wc_add_to_cart_message', 'add_to_cart_mod');
 function add_to_cart_mod($message) {
    $message = str_replace ( '&lt;a href="%s" class="button wc-forward"&gt;%s&lt;/a&gt; %s' , '&lt;a href="%s" class="button"&gt;%s&lt;/a&gt; %s', $message );
 return $message;
}
</code></pre>

<p>With this filter set as it is, I still see the button with the same unchanged class. Any thoughts?</p>