How to limit the quantity of a product to 1? Some stores sell products that can only be purchased once (for example, on iTunes, you can only buy a song for yourself once, or on Steam, you can only buy a game for yourself once).

So for products like this, how can I limit the quantity to 1 in Commerce?  (Users should never be able to order 2+ of any individual product of type myproducttype.)

There are some answers for doing this in Drupal 7:


Using rules to restrict anonymous users to quantity of 1
Limiting order quantity


Unfortunately, these solutions use Rules, which is still in alpha for D8.

So how can I programatically restrict the product quantity to 1 for a given product type?
For me, simply skipping to checkout does not address my desired workflow. I still want users to be able to shop around and use a cart.

But some of my products are subscriptions, for which it doesn't make any sense to have multiple. For this purpose, I'm using https://www.drupal.org/project/commerce_xquantity module.