Skip to content

Instantly share code, notes, and snippets.

@tdmrhn
Last active May 13, 2021 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdmrhn/a9aea2cc3e35939b677655b3a527fd35 to your computer and use it in GitHub Desktop.
Save tdmrhn/a9aea2cc3e35939b677655b3a527fd35 to your computer and use it in GitHub Desktop.
Add to Cart Redirect to Single Product Page
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 );
function replacing_add_to_cart_button( $button, $product ) {
$button = '<a class="ct-button" href="' . $product->get_permalink() . '">View product</a>';
return $button;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment