I have a specific use case where my anonymous users can't have a cart, but the Commerce cart module will allow anyone with the "access content" permission to have a cart. A nice feature would be to have a "have a cart" permission.

I'm writing a patch anyway I will need it, I'll be pleased to share it.

Comments

pounard’s picture

Status: Active » Needs review
StatusFileSize
new2.67 KB

Here is a simple patch that works for me, but I may forgot some details.

pounard’s picture

Warning: this is a SVN patch.

Status: Needs review » Needs work

The last submitted patch, commerce_cart-cart_permission.patch, failed testing.

rszrama’s picture

Yeah, I'd be hard pressed to say why I went with "access content" here... doesn't make much sense to me, and a specific permission would seem to do the job better. I'll ask around to see if there's a way we can add the permission with an update path.

pjcdawkins’s picture

+1.

I'd suggest a permission, e.g. "Use cart", which restricts access to the menu item "cart" and to the "Add to cart" button.

maxilein’s picture

I second that! I special "allow cart" would really make sence. At least in some of my use cases:

Why should the machine waste lots (!) of cycles (e.g. dynamic prices are being calculated upon putting things to the cart) for users who are not allowed to buy anyway?!

jgullstr’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Issue summary: View changes
StatusFileSize
new3.04 KB

Re-roll for latest dev (8441d69). Missing tests and upgrade path ("access content" --> "use commerce cart" permission)

jgullstr’s picture

Reroll for c8cd6b4

rszrama’s picture

Status: Needs work » Closed (won't fix)

I appreciate you rerolling this patch, but I'm going to close this as won't fix. There are far too many sites with far too many role configurations to make this sort of change reasonable at this point in time. No harm in using the patch as is on your own sites / new projects, but we aren't making such invasive changes in the Commerce 1.x branch any more.