Create an user group for users who can not put products in cart

What? A shopping cart with users which can't actually shop?

Weird or not, that was a recent request from one of my customers. He wanted to have a quick way to prevent some of his users from putting products in cart, but leave all other site functionality intact.

Simplest, as you might think! Of course, you must make your hands dirty with some code Wink. first of all, go to Components>VirtueMart>Admin Group>User groups and create a new usergroup, let's say "private" and set the associated User Group Level to 750 - or the maximum of your shop.

Then, go to your template files, and in the active templates, search where you have the code to show the Add-to-cart button, usually is something like this:

echo $addtocart;

Add a conditional statement to be shown only when the active user is NOT member of the "private" group, like this:

if ($auth[perms]!='private') echo $addtocart;

Save your files, and test it. Simple, eh?