Created
November 3, 2017 07:22
-
-
Save rynaldos-zz/fffac2366e49a11610fd15e29eb73ed4 to your computer and use it in GitHub Desktop.
[WooCommerce 3.0+] Change Add to cart button on archive page + open product page instead of adding to cart
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_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">Choose options</a>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment