Skip to content

Instantly share code, notes, and snippets.

@madeincosmos
Created December 8, 2017 08:08
Show Gist options
  • Save madeincosmos/d0c2ea6cc80fc2d3ed2a6b96989db8c1 to your computer and use it in GitHub Desktop.
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
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