I have a platform with roles for moderators, editors, teachers and students. Only student roles should be able to buy courses and the other roles should not be able to buy courses or see any of the commerce store information e.g. cart etc. How do I set their permissions? All roles still see "cart" in the menu bar. Am I missing a setting in permissions? There doesn't seem to be a permission for cart, only checkout permissions. What am I missing?

2 Answers 2



After a few nights of sleeping on it I believe I have a solution. I tested it and so far it works. But please let me know if you experience any issues with my solution below.

Step 1

a) Install Roles For Menu module (has a stable releases for this project are covered by the security advisory policy.)

b) Install the Path Access module together with the Chain Menu Access API (which is needed to install the Path Access module)

Step 2

a) Go to your menu links in the user menu admin/structure/menu/manage/user-menu (or wherever your 'my cart' link is located) and set the required roles to show and hide for that menu item.

b) Go to admin/config/people/pathaccess and add the paths that you wish to deny access to per role.

Now the roles who don't have access to any of these paths get an access denied page and those who do have access will just be able to use the store as intended.


In D7 you can use hook_menu_alter or check out https://www.drupal.org/project/menu_item_visibility for a no-code solution. If you can't access a page it won't appear in your menu - once logged in, at least.

  • Thanks. I think I found an alternative solution.
    – BassPlaya
    Apr 5, 2020 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.