Changing the button text to read ‘View Product’ in Woocommerce
In this case I have changed it to “Have a Look”…
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Replace add to cart button by a linked button to the product in Shop and archives pages add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_loop_add_to_cart_button', 10, 2 ); function replace_loop_add_to_cart_button( $button, $product ) { // Not needed for variable products if( $product->is_type( 'variable' ) ) return $button; // Button text here $button_text = __( "Have a Look", "woocommerce" ); return '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>'; } |