Adding Button to Shop Page in WooCommerce

Client has had me making tweaks to WooCommerce, most solutions through CSS.
This one, despite being simple, has had me stumped.

For each result that is returned on shop page client wants me to add a button next to “Add to Cart” that links to the product page (instead of just having clicking on the picture link to product page.)

Read More

Any suggestions on CSS as well as which CSS files to edit?

Related posts

1 comment

  1. You need to go beyond CSS to do this. It requires hooking into the loop template like so:

    add_action( 'woocommerce_after_shop_loop_item', 'my_112757_add_product_link', 11 );
    
    function my_112757_add_product_link() {
         global $product;
    
         echo '<a href="' . esc_url( get_permalink( $product->id ) ) . '">More Detail</a>';
    }
    

    Put the above code in your theme’s functions.php file. You can also add a class to the anchor tag to custom style the link the way you want.

Comments are closed.