Add To Cart issue

James Mosquito asked on March 1, 2021 10:53


I seem to be having a weird issue with the shopping cart:

  1. Adding a new product to cart for the first time works fine (a cart is created for the user/guest and the product is assigned to that cart.
  2. Adding a subsequent product will not create a new entry in the [COM_ShoppingCartSKU] table after calling mShoppingService.AddItemToCart(item.SKUID, item.Units);
  3. Despite not being added to the database table, the product can still be retrieved from the shopping cart service.
  4. The cart items will intermittently show in the basket page we created.

I realise this may be difficult to diagnose without seeing more source code etc. but wondered if there are any known issues that anyone is aware of that could be contributing, suggestions on things to look out for and imparticualry I am curious about point 2 above - is there a cached version of the cart?

Thanks, James

Recent Answers

Arjan van Hugten answered on March 1, 2021 12:26 (last edited on March 1, 2021 12:28)

You could use the 'SaveCart' method for saving the cart to the database. The cart is also saved in the session for the customer. But to ensure not losing the cart information between requests for the customer you can save it to the database.


Be sure to check the documentation about the ecommerce features and check the kentico API documentation when you are searching/looking for features that you need.

Customization for example for the cart validation or price calculation are possible but require some attention.

0 votesVote for this answer Mark as a Correct answer

James Mosquito answered on March 8, 2021 17:54 (last edited on March 8, 2021 17:55)

Thanks Arjan.

I tried calling SaveCart() after the AddItemToCart() method which didn't save it's contents into the database so I'm not sure at what point that takes place within the framework. I have narrowed the cause of our issue down to a cached repository method with a possible solution in sight.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.