Answers.Body: <p>I might be misunderstanding your situation, but Commerce has built-in min/max &quot;Allowed Quantity&quot; per product (per variant technically) here: <a href="https://i.sstatic.net/emgN2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/emgN2.png" alt="enter image description here" /></a></p>
  <p>Limiting that to 1 max will prevent more from being added to the cart. You'll just need to handle error messages at your end, naturally.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-23T15:34:53.393Z
Answers.Text: Talk about overthinking the issue! I thought it would have to be done in code.
  
  I'll keep that in mind, but I think in this site's case the owners may not like the idea of going through every variant to set a max.
Answers.UserDisplayName: Jaytrix
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-23T14:05:11.953Z
Answers.LastActivityDate: 2023-11-23T14:05:11.953Z
Answers.UserDisplayName: James Smith
Answers.Body: <p>I found a coded solution using <a href="https://craftcms.com/docs/commerce/3.x/extend/events.html#beforesavelineitem" rel="nofollow noreferrer">EVENT_BEFORE_SAVE_LINE_ITEM</a></p>
  <p>... but I think @JamesSmith's answer would be the ideal solution</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-23T15:34:19.553Z
Answers.LastActivityDate: 2023-11-23T15:34:19.553Z
Answers.UserDisplayName: Jaytrix
Body: <p>I have a site where the owners want to stop customers from ordering more than 1 type of item.</p>
  <p>The Twig logic is already in place to stop any forms showing that would allow customers adding more than type, which is fine for when navigating between pages.
  If a customer opens a product on several tabs, they can add multiples of the product.</p>
  <p>I had gone through the route listening for the <code>EVENT_BEFORE_ADD_LINE_ITEM</code>, but I think this isn't occurring as once a product is added to the cart any further products of this type aren't new line items, they are quantity changes.</p>
  <p>Is there an event to listen to for quantity changes for the cart?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-11-24T04:05:49.790Z
Comments.Text: I'm guessing that you meant to write that you want to stop customers from ordering more than 1 _of a single_ type of item, right? From the first paragraph of your question, I thought you were saying that an order must consist of only one line item, but that line item can have any quantity.
Comments.UserDisplayName: Sophie Swett
Tags: <craft3><plugin-craftcommerce><events>
Title: Stop customers from increasing line item
ThreadText: # Stop customers from increasing line item
  
  (Asked by: username_0 on 2023-11-23)
  
  I have a site where the owners want to stop customers from ordering more than 1 type of item.
  
  The Twig logic is already in place to stop any forms showing that would allow customers adding more than type, which is fine for when navigating between pages.
  If a customer opens a product on several tabs, they can add multiples of the product.
  
  I had gone through the route listening for the `EVENT_BEFORE_ADD_LINE_ITEM`, but I think this isn't occurring as once a product is added to the cart any further products of this type aren't new line items, they are quantity changes.
  
  Is there an event to listen to for quantity changes for the cart?
  
  **Tags:** craft3, plugin-craftcommerce, events
  
  > **Comments:**
  > **username_1**: I'm guessing that you meant to write that you want to stop customers from ordering more than 1 _of a single_ type of item, right? From the first paragraph of your question, I thought you were saying that an order must consist of only one line item, but that line item can have any quantity.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2023-11-23. Score: 2
  
  I might be misunderstanding your situation, but Commerce has built-in min/max "Allowed Quantity" per product (per variant technically) here: [![enter image description here](https://i.sstatic.net/emgN2.png)](https://i.sstatic.net/emgN2.png)
  
  Limiting that to 1 max will prevent more from being added to the cart. You'll just need to handle error messages at your end, naturally.
  
  > **Comments:**
  > **username_0**: Talk about overthinking the issue! I thought it would have to be done in code.  I'll keep that in mind, but I think in this site's case the owners may not like the idea of going through every variant to set a max.  
  
  ---
  
  ### Answer by username_0 on 2023-11-23. Score: 1
  
  I found a coded solution using [EVENT\_BEFORE\_SAVE\_LINE\_ITEM](https://craftcms.com/docs/commerce/3.x/extend/events.html#beforesavelineitem)
  
  ... but I think @username_2's answer would be the ideal solution
  
  
  ---
  
  