Storefront error library · Requests and cart · Reviewed November 15, 2026

cart/add.js 422 (Unprocessable Entity)
on a Shopify store.

POST /cart/add.js 422 with "Cart Error": sold out, not enough stock or "Cannot find variant". What Shopify’s Cart API is telling you and how to stop it costing orders.

The short answer

Shopify’s Cart API refused an add: stock or an unknown variant. The 422 is Shopify working correctly. The sale is lost when the theme ignores it: the shopper clicks Add to cart, nothing happens, and they leave thinking the store is broken. A visible “sold out” message keeps them browsing; a silent failure does not.

At a glance

cart/add.js 422 (Unprocessable Entity) in three lines.

Who can fix itYour theme developer for the message; merchandising for stock and variants
Does it cost sales?When the theme shows nothing after the refusal
What Dozenfold does with itOpens an issue for 422s your theme sent, with the sessions and whether they still ordered
GroupRequests and cart
Last reviewed

What you see

The exact messages.

The same problem is worded differently by each browser and tool. Search your console and error tracker for all of them.

WhereMessage
ConsolePOST https://your-store.com/cart/add.js 422 (Unprocessable Entity)
Response body{ "status": 422, "message": "Cart Error", "description": "The product 'Rain Coat' is already sold out." }
Response body{ "status": 422, "message": "Cart Error", "description": "You can't add more Rain Coat to the cart." }
Response body{ "status": 422, "message": "Cart Error", "description": "Cannot find variant" }

What it means

In plain English.

Shopify’s Ajax Cart API received the request and refused it. The reason is in the JSON description, not in the status code.

Shopify documents three: the product is sold out; all of its stock is already in the cart, or more was asked for than is available (Shopify then adds what it can); or the variant ID does not exist or is not available on the online store channel.

Does it cost sales?

Which steps it can break.

When it happens on the path to purchase, look first at:

  • Add to cart on product pages
  • Quick add on collection pages
  • Bundle builders and upsell offers

Why it happens on Shopify

The usual causes.

Sold-out variants that can still be selected

The variant picker lets shoppers choose a sold-out option, and the button stays enabled.

A variant ID that changed

Products deleted and recreated, imported again or edited through the Admin API get new variant IDs. Hard-coded IDs in sections, bundles or upsells stop working. Shopify notes that Admin API changes can take a few seconds to reach the Cart API.

Not available on the Online Store channel

A product that is active but not published to the online store returns “Cannot find variant”.

Quantity limits

Quantity selectors that allow more than the stock, or upsell apps that add an item already in the cart.

Real problem or noise?

Check this before anyone debugs.

Most stores log this error at some level. These signals tell you whether real shoppers are affected.

  • RealThe button gives no feedback after the 422.
  • Real“Cannot find variant”. A broken variant ID never sells.
  • Expected“sold out” refusals with a visible message, on products that really are out of stock.

How to fix it

Reproduce, then fix.

  1. 01

    Show Shopify’s description

    Read the JSON body of a failed add and show the description next to the button.

    const res = await fetch('/cart/add.js', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ items: [{ id: variantId, quantity }] }),
    });
    if (res.status === 422) {
      const error = await res.json();
      showMessage(error.description);
      return;
    }
  2. 02

    Disable what cannot be bought

    Use variant.available from the product JSON to disable sold-out options and the button, and cap the quantity selector at what is in stock where you show it.

  3. 03

    Stop hard-coding variant IDs

    Pick variants in the theme editor with a product setting, or look them up from the product JSON at render time.

  4. 04

    Check channel availability

    For “Cannot find variant”, check that the product is published to the Online Store sales channel.

Find it automatically

Know which errors cost orders.

When your theme sends the add, Dozenfold opens one issue for 422s on that cart route, with the line of theme code that made the request, the browsers and pages it happens on and the sessions that hit it.

It then compares those sessions with clean ones at the same step, so you see whether the refused adds cost orders or were shoppers who found another size. Dead-click detection also flags an Add to cart button that showed no change after a click.

14-day trial · From $49 a month · Billed through Shopify

Questions

cart/add.js 422 (Unprocessable Entity): FAQ.

Is a 422 from cart/add.js a Shopify outage?

No. It is the Cart API refusing one request for a reason in the response: sold out, stock already in the cart or an unknown variant.

Why does Shopify return "Cannot find variant"?

The variant ID does not exist or the product is not available on the online store channel. Recreated products and hard-coded IDs are the usual cause.

What happens if a shopper asks for more than the stock?

Shopify adds the maximum available quantity and returns the 422 explaining that no more can be added.

Should I hide sold-out variants?

Disable or mark them, and show a message when an add is refused. Silent failure is what costs the order.

Written by the Dozenfold team, who build storefront error monitoring for Shopify. Reviewed November 15, 2026 against Shopify: Cart API reference, error responses.

DOZENFOLD / PRIVACY

Make yourself at home.