I used the following code to hide the single product pages on woocommerce, which worked perfectly. Anyone trying to access single product pages are redirected to the home page.
I now want to hide the category pages. I dont need these as I am using the category shortcode to display product on other pages. Can anyone help with the required code?
//Removes links
add_filter( 'woocommerce_product_is_visible','product_invisible');
function product_invisible(){
return false;
}
//Remove single page
add_filter( 'woocommerce_register_post_type_product','hide_product_page',12,1);
function hide_product_page($args){
$args["publicly_queryable"]=false;
$args["public"]=false;
return $args;
}
Taken from: How to disable/hide woocommerce single product page?