I am trying to hide the single product detail page on my wordpress-woocommerce site. How can i achieve this without breaking woocommerce functionality?
The single page is something that is provided from WordPress and there is no way to disabled it. But there some ways to prevent access to single product page.
The first one is to edit your shop (products-archive) template and to delete all the places where you have a link to the single page.
The second is to do a check on each page load if the page is a single product page and redirect the user to wherever you want:
add_action('init','prevent_access_to_product_page');
function prevent_access_to_product_page(){
if ( is_product() ) {
wp_redirect( site_url() );//will redirect to home page
}
}
You can include this code in your functions.php file of your child-themes directory. Have in mind that I've haven't tested the code.