Created
December 8, 2017 08:08
-
-
Save madeincosmos/d0c2ea6cc80fc2d3ed2a6b96989db8c1 to your computer and use it in GitHub Desktop.
Change the Add to cart button on shop pages into a Read More link
This file contains hidden or 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_action('init','remove_loop_button'); | |
function remove_loop_button(){ | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); | |
} | |
add_action('woocommerce_after_shop_loop_item','replace_add_to_cart'); | |
function replace_add_to_cart() { | |
global $product; | |
$link = $product->get_permalink(); | |
echo do_shortcode('<a href="'.$link.'" class="button addtocartbutton">Read More</a>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment