Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm going crazy!
I need to sell online "audio books" on my website. So, if an user buys an audiobook it assumes a specific role that, for clarity, is the name of this book. When he assumes this role, he can read chapters of this book.
All works, but the "add to cart" button in product page is always visible, even if this user bought the product.
I want to disable this button if the user has already bouht the book, it's simple, but I'm unable to do this.
Help please!
Comments
Comment #2
Cayenne CreditAttribution: Cayenne commentedTwo ways to do this in D7, I think.
1. Use panels and have the add to cart form appear in a panel that is hidden when that particular class of user is logged in or
2. a small custom module that makes use of hook_form_alter to hide or unset the bit of code that translates to the "add to cart" form.