A simple module registering event subscriber which reacts to add to cart event removing all the products from cart and placing only newly added product into the cart in a quantity of 1.
This might be useful for single-product websites or subscription-based websites where this functionality is desired.
- Drupal Commerce
- Drupal 8 / 9 (not tested in 9 but it should work)
To install this module you will want to put the source in the appropriate directory. After you have placed the module there, simply enable it as you would any other module.
No configuration is needed. Simply enabling the module and clearing the cache should do the trick. Module does no change to database tables so removing the module is done by uninstalling and deleting the folder. Easy as that.