Remove Woocommerce product link

I’d like to remove the link from the Woocommerce product listings. I don’t need the user to see the product detail pages, we are going to use Quick View instead. Anywho, I have been searching and everything I’ve found is outdated. This is the current content-product.php file: https://github.com/woothemes/woocommerce/blob/master/templates/content-product.php and there are no anchor tags to simply remove.

I might need a hook but I’m not sure what to do. I tried a few but the link was still there. For example this didn’t work when added to my functions.php:

 add_filter('woocommerce_template_loop_product_link_open','mbc_remove_link_on_thumbnail' );

 function mbc_remove_link_on_thumbnail($html){
      return strip_tags($html,'<img>');
 }

I also tried this which didn’t work but I feel is close:

 remove_action ('woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10);
 remove_action ('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5);

I’m not sure if I’m even on the right track. Any help would be appreciated!

5 Answers
5

The way I’ve done this was to take a copy of content-product.php and paste it into the root of your theme folder.

Comment out

do_action( 'woocommerce_before_shop_loop_item_title' );

and

do_action( 'woocommerce_after_shop_loop_item' );

Quick and dirty, but it worked for me.

Leave a Comment