Problem/Motivation
Steps to replicate:
- User already has a license role
- User chooses to add the same licensed product to the cart
User sees add to cart message, and another message You already have the foobar role. You may not purchase the foobar product.. And there is nothing added to the cart.
Proposed resolution
The check should be done before the item is added to cart.
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comments
Comment #2
joachim commented>The check should be done before the item is added to cart.
It's not as simple as that, unfortunately...
Try one of these commerce patches -- I forget which one does the trick:
- #2903504: Add form validations in Cartform and in AddToCartForm
- #2930979: don't show the 'added to your cart' message if the item quantity is unchanged or 0; make CartEntityAddEvent aware of the original order item
Comment #3
drupgirl commentedDuplicate: https://www.drupal.org/project/commerce/issues/2930979