Tips and Tricks HQ Support Portal › Forums › Simple PayPal Shopping Cart › Simple Shopping Cart Tweaks › Automatically require users to be logged in? › Reply To: Automatically require users to be logged in?
December 15, 2009 at 7:31 am
#16741
Participant
Yeah this should be easy to implement. All you gotta do is check if the visitor is logged in when they hit the “Add to Cart” button. If they are logged in then let them process as usual or else redirect them to the Login page.
Search for the following piece of line in the code (this is what gets executed when the button is clicked:
if ($_POST['addcart'])
You will need to add the check for is_user_logged_in()
inside this if statement block and redirect to the login page if the user is not logged in.