Hide product detail pages
-
Hello there,
I’d like to remove the link from the product listings to the product detail page. My client only wants to use quick view. How can I remove the link? I understand it will involve modifying template files but I’m having trouble finding where to edit.
-
I think the link is in:
wp-content/plugins/woocommerce/templates/single-product/product-image.phpHi Iorro,
Thanks for replying. /product-image.php is for the product’s image gallery though, or at least that’s what it looks like to me. My goal is to remove the link to the product detail page from the product listings.
To clarify I mean the product listings on /shop or /product-category, etc. I don’t want the listings to link to a detail page because I just want to use Quick View, no deed for a detail page.
OK. Try content-product.php, and comment out lines 49 and 76 (WC 2.4.x) in the edited template. This time I tested before posting…
Hi again,
Line 49 is an ending curly bracket and line 76 is a space. Can you tell me the lines according to this: https://github.com/woothemes/woocommerce/blob/master/templates/content-product.php#L49
Thanks for your help!
I still have v2.4. The new version 2.5 is a bit different in respect of this issue. The open link and close link codes are now hooked. This means there is no need to make a new template. Instead, you can unhook the open and close links as follows:
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);This code goes in your theme’s functions.php. To avoid edits being overwritten by theme updates, you should make a child theme and use functions.php in the child theme.
I’m sorry, not tested. I’ll be waiting a few days before updating.
I feel like you’re really close with that, but the links are still active.
I have tested the remove_actions and they work with a theme which does not come with its own WooCommerce templates. Do you have a theme template file at:
wp-content/themes/your-theme-name/woocommerce/content-product.php
If you do and its not been updated to be compatible with v2.5 then it would be necessary to go back to the method for 2.4 for the time being.Someone was able to solve this on wordpress.stackexchange, here was their solution:
Comment out
do_action( 'woocommerce_before_shop_loop_item_title' );and
do_action( 'woocommerce_after_shop_loop_item' );Here’s a link to their answer: http://wordpress.stackexchange.com/questions/215124/remove-woocommerce-product-link/215127#215127
You’ll lose the add-to-cart button that way.
Crap you’re right. I did lose the add to cart. Reopened this.
OK, so do you have:
wp-content/themes/your-theme-name/woocommerce/content-product.php
if so, this will take precedence over the WooCommerce version. At the top of it, it should say whether its based on WC 2.4 or 2.5.Yes and it’s 2.5
I don’t have access to your theme. Could you post that file here:
http://pastebin.com/Yes I’m sorry I didn’t realize you were asking for it. Here is what it looks like in woocommerce: http://pastebin.com/tmySrbTE
I actually found that my theme has a much different content-product.php. I commented out all links that are obviously links (besides Quick View) and I also lost my Add to Cart button. Here is the theme’s file: http://pastebin.com/KB0VRfb4
So looks like woocommerce is 2.5 and the theme is using 2.4
The topic ‘Hide product detail pages’ is closed to new replies.