Commerce limit the quantity of product to 1
What you will want to do is add an event subscriber to the Add to Cart event (https://github.com/drupalcommerce/commerce/blob/8.x-2.x/modules/cart/src/Event/CartEvents.php#L30).

Here is an example piece of code that would react to that event. This is for a Drupal Commerce site which only allowed purchasing one product at a time with a quantity of one.

/**
 * Sets quantity to 1 and ensures only one product in the cart.
 *
 * @param \Drupal\commerce_cart\Event\CartEntityAddEvent $event
 *   The cart event.
 */
public function onProductAdded(CartEntityAddEvent $event) {
  // We only want 1 quantity.
  $cart = $event-&gt;getCart();
  $added_order_item = $event-&gt;getOrderItem();
  $cart_items = $cart-&gt;getItems();
  foreach ($cart_items as $cart_item) {
    if ($cart_item-&gt;id() != $added_order_item-&gt;id()) {
      $cart-&gt;removeItem($cart_item);
      $cart_item-&gt;delete();
    }
  }

  $quantity = $cart_items[0]-&gt;getQuantity();
  if ($quantity &gt; 1) {
    $cart_items[0]-&gt;setQuantity(1);
  }

  $cart-&gt;save();
}