Answers.Body: <p>So this is for coupons?</p>
  
  <p>If a coupon can't be applied during an <code>updateCart</code>, you'll get back the rather unhelpful response in JSON of <code>{"error":"Cart not completely updated."}</code></p>
  
  <p>We intercept this, and because we know it's a coupon operation just replace the text of that to 'Could not apply coupon'.</p>
  
  <p>But it does not give you a reason or anything, unfortunately.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-17T16:22:41.993Z
Answers.Text: can I ask how you intercept and output the error message? Even some form of feedback would be useful.
Answers.UserDisplayName: Terry Upton
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-17T22:57:56.517Z
Answers.Text: I just check for `response.success` and `response.error` - and take appropriate action in the JS from there.  In our case we throw up a little red x and pop up message on the button.  Meet me on slack if you need more specifics...
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-07T23:37:20.633Z
Answers.LastActivityDate: 2016-12-07T23:37:20.633Z
Answers.UserDisplayName: Jeremy Daalder
Body: <p>Is there any automatic Error trapping built into Craft for discount codes for the following rules?  </p>
  
  <ul>
  <li>Orders over a set Total</li>
  <li>Orders over a set Quantity</li>
  </ul>
  
  <p>The codes work/apply, but if the rules don’t match I am not getting any errors/messages back.
  Any ideas? Do we have to write checks for every scenario?</p>
  
  <p>There are likely more scenarios than the two I have listed above. It seems a little poor UX to appear to do nothing, no error, no discount applied if the contents of the cart don't qualify. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-08T00:47:04.433Z
Comments.Text: Can you get the error with `cart.getError('couponCode')` ?
Comments.UserDisplayName: Luke Holder
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-08T07:56:01.947Z
Comments.Text: No error is returned. I'm guess as there isn't an error as such. Just the cart contents don't qualify the discount. Once they do the discount is automatically applied. There are several instances of this. Is this something that could be expanded to better error trap?
Comments.UserDisplayName: Terry Upton
Tags: <plugin-craftcommerce><discounts>
Title: Error trapping on discount codes based on Cart contents
ThreadText: # Error trapping on discount codes based on Cart contents
  
  (Asked by: username_0 on 2016-12-06)
  
  Is there any automatic Error trapping built into Craft for discount codes for the following rules?
  
  * Orders over a set Total
  * Orders over a set Quantity
  
  The codes work/apply, but if the rules don’t match I am not getting any errors/messages back.
  Any ideas? Do we have to write checks for every scenario?
  
  There are likely more scenarios than the two I have listed above. It seems a little poor UX to appear to do nothing, no error, no discount applied if the contents of the cart don't qualify.
  
  **Tags:** plugin-craftcommerce, discounts
  
  > **Comments:**
  > **username_1**: Can you get the error with `cart.getError('couponCode')` ?  
  > **username_0**: No error is returned. I'm guess as there isn't an error as such. Just the cart contents don't qualify the discount. Once they do the discount is automatically applied. There are several instances of this. Is this something that could be expanded to better error trap?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-12-07. Score: 1
  
  So this is for coupons?
  
  If a coupon can't be applied during an `updateCart`, you'll get back the rather unhelpful response in JSON of `{"error":"Cart not completely updated."}`
  
  We intercept this, and because we know it's a coupon operation just replace the text of that to 'Could not apply coupon'.
  
  But it does not give you a reason or anything, unfortunately.
  
  > **Comments:**
  > **username_0**: can I ask how you intercept and output the error message? Even some form of feedback would be useful.  
  > **username_2**: I just check for `response.success` and `response.error` - and take appropriate action in the JS from there.  In our case we throw up a little red x and pop up message on the button.  Meet me on slack if you need more specifics...  
  
  ---
  
  