Adding to the cart answers 200 either way, so the reason is in the cart's messages, as an error. There are three causes, most likely first:
- The form sends the product's own code, but the product has variants. Once a product has variants, only a variant can go in the cart, and the add answers "Item could not be added to cart as it has variants, one of them has to be chosen instead". Send the chosen variant's SKU, as the product page on Catalogue pages does. A line for that product that is already in the cart stays unavailable with "Item has variants, one of them has to be chosen instead"; remove it.
- The quantity breaks one of the product's purchase controls. The line stays in the cart at the quantity asked for, marked
available: false, with a message that names the rule, such as "At least 4 of Gift card is required; the cart has 3". It stays unavailable until the quantity is changed. Lines with the same product code count together, so two lines of one product with different attributes add up, and changing one line can make the others available again. - The overall quantity counts past orders. "At most 5 of Gift card can be purchased in total; 3 already purchased, the cart has 3" counts the orders the customer has already placed, within the overall period when one is set. A guest cart with no customer record counts the cart only, so a returning customer can be refused a quantity a guest is allowed. A message without the purchased part is the same rule, shown to anyone who is not signed in as that customer.
A line held back by a purchase control looks like this in the cart's answer: