Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Change Add To Cart Link On Archive and Shop Pages

Home / Forums / Virtue Theme / Change Add To Cart Link On Archive and Shop Pages

This topic is: Resolved
[Resolved]
Posted in: Virtue Theme
  • This topic has 8 replies, 2 voices, and was last updated 8 years ago by Kai.
April 9, 2018 at 5:10 pm

Hi there ~

On my shop and archive pages I would like the “add to cart” button replaced with a “view details” button that links to the single product page for each product.

The closest I’ve come to making it work is with this code I found.
I put this in my child theme functions.php file.

add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 );
function replacing_add_to_cart_button( $button, $product ) {
$button_text = __("View product", "woocommerce");
$button = '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';

return $button;
}

The code created buttons with a link to the single product page for each product, but it takes away all the pretty styling and animation that comes with the virtue theme.

Any guidance on how to make this work while keeping the original styling?

Website

Thank you!

  • The forum ‘Virtue Theme’ is closed to new topics and replies.