Last active
October 13, 2024 07:17
-
-
Save emre-edu-tech/6c61eb561a0321df94bd29ea02770649 to your computer and use it in GitHub Desktop.
Woocommerce - Change add to cart button to a Product Details Button on product archive page
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
<?php | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_add_to_cart_button_on_product_archive', 10, 2 ); | |
function replace_add_to_cart_button_on_product_archive($button, $product) { | |
$button_text = __("Show Product", "textdomain"); | |
$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