Created
December 5, 2017 03:52
-
-
Save lukecav/807ccf489637950113e9c3ca69ef8113 to your computer and use it in GitHub Desktop.
Replacing the button add to cart by a link to the product in Shop and archives pages in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 ); | |
function replacing_add_to_cart_button( $button, $product ) { | |
$button_text = __("View product", "woocommerce"); | |
$button = '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>'; | |
return $button; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/46111205/replace-add-to-cart-button-with-a-read-more-linked-to-product-page-on-shop-pages