Great question — answering as the UphillTech team:
Explanation and Fix I hit this error while calling cartLinesAdd : { "data": { "cartLinesAdd": { "cart": null, "userErrors": [ { "code": "INVALID", "field": ["lines", "0", "quantity"], "message": "The product 'X' is already sold out." } ] } } } It looks like an inventory problem, but the real culprit turned out to be shipping rates . What was really happening The product’s only stock was stored in a new location ( "Japan" ). That location wasn’t covered by any shipping rate for the buyer’s country ( USA ). During cartLinesAdd , Shopify checks: “Do I have at least one rate from the location that holds the stock to the destination country?” If the answer is no , the API returns the “sold out”...
Full answer by Jeremy Mejia: https://stackoverflow.stackexchange.com/a/79689088 (CC BY-SA 4.0).
Need it done for your business? UphillTech.