I have to hide the possibility to buy for not logged in users (whole domain or store)

Ex:
If a user is NOT logged in (don’t have an account) then the cart button etc will not show. Sees only a link “See store locator list”.

Only if user logged in will they show prices and button “Buy” and they will have the opportunity to purchase.

example code
if(is_user_logged_in()
Buy

if(is_user_NOT_logged_in()
Show “See store locator list” with page URL.

How to do it?
Please could someone help?

I found this example: Function Reference/is user logged in
Display different output depending on whether the user is logged in or not.

<?php
if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!';
} else {
    echo 'Welcome, visitor!';
}
?>

Did it change in the “/WooCommerce/Templates/Loop/add-to-cart.php” enough?

But still need help :(
How to put this code into “buy” button?

Read more here: Changing the Purchase Button - Woocommerce


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: