# Cart error messages that name the field that failed

Source: https://cartcomply.com/blog/2026-11-06-cart-error-messages-name-failed-field.html

A shopper enters a discount code, taps apply, and the cart says something went wrong. Nothing else. No field named, no reason given, no way forward except guessing. That message is not just bad writing. It fails WCAG 2.2 Success Criterion 3.3.1, Error Identification, which requires that when an input error is detected automatically, the item in error is identified and the error is described in text. Colour alone is not enough, and a generic message is not a description.

The fix is unglamorous and it works: name the field, say what is wrong, and say how to fix it. The code has expired is a complete error message. Something went wrong is a shrug with a submit button attached. The difference is three words, and it is the difference between a shopper who retries and a shopper who leaves.

## What 3.3.1 actually requires

Criterion 3.3.1 is Level A, which means it sits at the base of every conformance claim. It requires two things: the item in error is identified, and the error is described to the user in text. A red border identifies nothing to a screen reader user, and a red border plus a generic message identifies the cart, not the field. The test is simple: can a shopper who cannot see the page tell which field failed and why, from the text alone?

Most carts fail this test on the discount code field first, because it is the field where errors are most common and the messaging is laziest. Then they fail it on quantity, where a shopper enters 0 or a number above stock and gets a message about an invalid entry with no mention of the limit. Then they fail it on the gift card field, where a balance error is reported as a payment error, sending the shopper to the wrong field entirely.

## The pattern that passes

Put the error in text next to the field, link the field to the message with aria-describedby, and set aria-invalid on the field. Move focus to the first error when the form is submitted with errors, and announce the error with a polite live region so screen reader users hear it without hunting. None of this is new technology. It is the same pattern the GOV.UK design system has published for years, and it is the pattern every audit checks first because it is the easiest to test and the most commonly broken.

Count the cost honestly. A cart error that names the field takes a developer an afternoon to implement across the cart's fields. A cart error that does not name the field costs a sale every time a shopper with a screen reader, or a shopper in a hurry on a phone, hits it and gives up. The second cost repeats. The first does not.

## The check to run this week

Open the cart, enter a bad code, enter a quantity of zero, and submit with an empty gift card field. Read every error message out loud. If any of them would leave a stranger guessing which field failed, it fails 3.3.1, and it is losing sales to people who will never tell you why they left. Fix the message, then fix the next one. There are only so many fields in a cart.

Keep reading: [Accessible quantity steppers: the cart control screen readers mangle most](2026-11-05-accessible-quantity-steppers-cart.md), [Accessible promo code errors and cart announcements](2026-11-04-accessible-promo-code-error-cart-announcements.md).

## Frequently asked questions

### What does WCAG 3.3.1 require for cart errors?

When an input error is detected automatically, the item in error must be identified and the error described in text. A red border alone does not meet it, and neither does a generic message like something went wrong, because neither names the field or the problem.

### Is a red border plus an error icon enough?

No. Colour and icons are not text, and a screen reader user gets neither. The error needs words, next to the field, linked to it with aria-describedby, with aria-invalid set on the field.

### Should the error message move focus?

When a form is submitted with errors, move focus to the first error, or to an error summary that links to each field. A shopper who cannot see the page should land on the problem, not have to search for it.

### Which cart field fails this most often?

The discount code field, then quantity, then gift cards. Discount codes fail because the message is lazy. Quantity fails because the limit is not stated. Gift cards fail because a balance error is reported as a payment error, pointing at the wrong field.
