How to disable the add to cart button if the shop owner does not have the premium role? I created a marketplace (several stores on the same site) and the merchant can create a paid subscription to have the "Premium" role. Here's what I want to do:


The owner of a store has the role "Premium" = the website visitors have access to the button "Add to cart" on the product pages of his store.
The owner of a store does not have the role "Premium" = the website visitors do not have access to the button "Add to cart" on the product pages of his store.


How to disable the add to cart button (FOR VISITORS) if the owner of the store does not have the "Premium" role? *

Can I do that with a TWIG? If yes, how ?

Read my question. Depending on the role of the owner of a store, all users must be impacted.

WHY :

On my markerplace, I want to set up a paid subscription for sellers.


If the owner of a shop is not subscribed, he can not sell his products ("Added to Cart" button disabled).
If the owner of a shop is subscribed, he can sell his products (button "Added to cart" activated).


Whether the owner of a store is subscribed or not, everyone needs to see the stores and products. Only the "Add to Cart" button is impacted.
Yes, you can do this in twig file. So you will have to create a commerce product twig file(you can copy it from commerce module template). In the preprocess hook you will have to pass a value whether that product can show cart button or not. In your twig file you can use value of that flag around {{ product.variation }}. Add to cart button is rendered by this variable.