WooCommerce: How To Remove links product details pages

WooCommerce How To Remove links product details pages-Here and there, WooCommerce storekeepers would prefer not to show a connects to the item subtleties pages on the item posting page on their site. This can be useful in the event that you are going to utilize Quick View rather, or your items don’t require much depiction, or you connect to item pages somewhere else.

This will leave only the “Add to cart” button available, so customers will not be able to get to the product details page, but they will still be able to purchase the product. In this article, I will tell you the best way to evacuate the connections to the item subtleties pages from the item posting page of a WooCommerce store.

A better and safer way to solve this is by removing the open and close link actions. This will prevent side effects such as the “Add to cart” button disappearing.

To do this, add the following PHP snippet to functions.php file of your child theme .

// Remove links to the product details pages from the product listing page of a WooCommerce store
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 );

If this code doesn’t work with your theme, the hooks and/or priorities may be different. Look at wp_content/themes/your-theme-name/woocommerce/content-product.php to see how your theme has done this.

WooCommerce How To Remove links product details pages

If you want to target only a specific category then add the following PHP snippet to functions.php file of your child theme .

// Remove links to the product details pages from the product listing page of a WooCommerce store (only a specific category)
if ( is_product() && is_product_category( array('category-slug') ) ) {
    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 );
}

If this code doesn’t work with your theme, the hooks and/or priorities may be different. Look at wp_content/themes/your-theme-name/woocommerce/content-product.php to see how your theme has done this.

That’s it, you’re done. Now the links to the product details pages removed. So simple isn’t it? I hope this article has helped you learn how to remove the links to the product details pages from the product listing page of a WooCommerce store. If this article helped you then please leave a comment

Was this post helpful?

You May Also Like

Abdul Vakeel

About the Author: Abdul Vakeel

WPBeginner Blog is a Free WordPress Resource Site For Beginners. WPBeginner Blog Was Founded in 4th June 2019 By Abdul Vakeel.

Leave a Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published.

𝐖𝐏𝐁𝐞𝐠𝐢𝐧𝐧𝐞𝐫 𝐁𝐥𝐨𝐠  website uses cookies which may collect personal information. By staying here you are agreeing to our use of cookies and to our terms and conditions which includes our Privacy Policy for use of this website.L̶e̶a̶r̶n̶ ̶M̶o̶r̶e̶.