Using PrestaShop 126.96.36.199, this was an older shop that had been offline for a couple of years. It had been upgraded in steps from PrestaShop 1.4 via 1.5 to 1.6. While testing it before relaunch of the shop a problem was discovered. Sometimes when adding a product to the shopping cart, another random product was added. When testing the shop in incognito/private mode this happened more frequent.
It turned out to be a discrepancy between cart ID:s in the two tables ps_cart and ps_cart_product.
- Use phpMyAdmin or similar to open your PrestaShop database.
- Go to the table ps_cart_product, make sure it is ordered by the id_cart column and go to the last page.
- Make a note of the highest id_cart value.
- Go to the table ps_cart, make sure it is ordered by the id_cart column and go to the last page.
- Compare this table’s highest id_cart value with the one you found in ps_cart_product. It will probably be a lower number and this is what is causing the problem. When a visitor puts something in a cart, a new row is created in ps_cart with id_cart value auto incremented but there is already a row in ps_cart_product with this id_cart value from a previous visitor.
- Add a new row to ps_cart and in the id_cart field enter the number of the highest value you found in ps_cart_product. Then save the row.
- You will probably see some error message about invalid or missing fields but that will be ok as long as the row is saved.