Commerce - Hide Add-to-Cart form from Anonymous users I am constructing a site that will serve mainly agents (authenticated users), but should still show all of the products (without prices) for anonymous users. When logged in, only agents should see the Add-to-Cart form on the product display page, and anonymous users should instead see a link to an "Ask a Question" page.

Is this possible? I looked through the permissions table and could not find a way to prevent access to the cart form by anonymous users.

The only thing I can think of doing is customizing my node--product-display.tpl.php file:

&lt;?php  
    if ($logged_in) {
      print render($page['content']);
  } else {
      // something else
  }
?&gt;


I'll have to print the rest of my fields out manually, but as far as I know, this is the only way to print the Add to Cart form. I'm a bit uneasy about this, so I'm humbly looking here for another solution.  thanks
From the link : http://www.drupalcommerce.org/node/2528 with an condition for anonymous user added.


  It's taken me a while but I've finally cracked it! I've used
  hook_form_FORM_ID_alter() (that took me some learning and meant I had
  to create my own, admittedly trivial, module!). So in my module I've
  got the following which sets #access for the submit form to false
  which stops it being rendered (see
  http://api.drupal.org/api/drupal/developer%21topics%21forms_api_referenc...).
  
  In the future, I'll be able to extend this to disable the button on
  certain conditions (say when there's no stock but I want to show what
  combinations are possible). It would also presumably be an easy way of
  changing, say, the text for the button, such as "Buy" instead of "Add
  to cart".


  function mymodule_form_commerce_cart_add_to_cart_form_alter (&amp;$form, &amp;$form_state, $form_id) {
global $user;
    if ($user-&gt;uid == 0) {
    // Disable the Add to Cart submit button


  $form['submit'] = array('#access' =&gt; FALSE);
        }    
    }