Hi @prokops,
Yes, you can do that with a snippet. Please add the following to your child theme’s functions.php or through the WPCode plugin
add_action('wp_head','remove_add_to_cart');
function remove_add_to_cart(){
if(!is_user_logged_in()){
add_filter( 'woocommerce_is_purchasable', '__return_false');
}
}
add_filter('woocommerce_short_description','ask_login');
function ask_login($description){
if(!is_user_logged_in()){
echo "<p><a >Login to add to cart</a> </p>";
}
return $description;
}
This will allow the users to see the price but be unable to purchase until they log in, it’ll also show a login to view the price on the short description area on the product page.
Please note to update the https://google.com link to the link of your website’s login page.
I’ll include some useful articles if you’d like to further learn the code:
Hope this helps. Let us know if you have other questions.
Cheers,