Closed (fixed)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Cart
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Jul 2017 at 10:53 UTC
Updated:
5 Apr 2018 at 10:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
waspper commentedAdded a small patch.
Comment #3
bojanz commentedGood catch. We also need to make the cart block respect the same permission.
Comment #4
waspper commentedAdded asked improvements to the patch.
Comment #5
Anonymous (not verified) commentedWorks for me. I am able to disable the add to cart button for anonymous users
Comment #6
bojanz commentedThis needs a test.
Comment #7
bojanz commentedI don't like this because it hides the form after it has already been built. A lot of work has happened for nothing (loading variations, rendering attributes, checking availability). We need to move the permission check up the stack, to either AddToCartFormatter or ProductLazyBuilders. This will depend on how we account for cachability, we need to ensure that the user.permissions cache context is added.
EDIT: mglaman confirms it, we want to modify AddToCartFormatter.
Comment #8
bojanz commentedrszrama and mglaman feel that having a single permission is not enough, and that the existing permission is misnamed. They suggest having one for the cart page, one for the cart block, and one for the add to cart form.
Since that's is out of scope for a bug report, mglaman will open a feature request for the community to give feedback on, and I'll remove the unused/wrong permission here.
Comment #9
mglamanLinking to issue where we can discuss a full-fledged implementation: #2955039: Provide granular permissions for Cart functionality
Comment #11
bojanz commentedDone.