This can sometimes occur when adding an add to cart button and using the Lookup Item ID from recordset option when the recordset has an Order By clause.
If you are using a recordset with an Order By clause, try removing it temporarily, then adding the add to cart button. You can replace the order by clause after the add to cart button has been added to the page.