The product archive page in WooCommerce (typically your shop or category pages) is one of the most visited sections of any online store. By default, WooCommerce displays an “Add to Cart” button for products. But what if you want to add a “View Product” button to encourage users to explore the product details before making a purchase? In this guide I will show you how to do that with a simple code snippet.
// Custom "View Product" button by DigantaSarkar.Com
add_action('woocommerce_after_shop_loop_item', 'add_view_product_button', 11);
function add_view_product_button() {
global $product;
echo '<a href="' . esc_url($product->get_permalink()) . '" class="button view-product-button">Leggi</a>'; //Button name here
}
The product archive page in WooCommerce (typically your shop or category pages) is one of the most visited sections of any online store. By default, WooCommerce displays an “Add to Cart” button for products. But what if you want to add a “View Product” button to encourage users to explore the product details before making a purchase? In this guide I will show you how to do that with a simple code snippet.