Shopping Cart

Miguel Vieira asked on June 11, 2015 16:56

Is there a way to reset all the users shopping cart, removing every item there is inside?

I saw that there is a a scheduled task by the name of "Delete old shopping carts". We ran that task but there wasn't any change in the shopping cart.

Does it only remove after X amount of days?

Recent Answers


Joshua Adams answered on June 11, 2015 17:15

If you want to remove all items from the users carts, you will most likely have to write a custom function that loops through all of the users/customers and cleans the cart out. What is the reason behind you wanting to do this?

Just as a reference. So first you would need to get the users/customers cart in the loop, and then call that method on the shoppingcartinfo obj that you get from the ShoppingCartInfoProvider.GetShoppingCartInfo(UserID,SiteName) method, and then call CleanUpShoppingCart() which deletes the cart from the database and session. Just beware that this can't be reversed without a database backup, so I would make sure that this absolutely has to be done. Maybe explaining why this has to be done can help us determine if that is the case.

0 votesVote for this answer Mark as a Correct answer

Miguel Vieira answered on June 11, 2015 17:29

If a client has a item in the shopping cart the content manager can't change its variants.

For example, I was trying to remove the variants of an item, but when i try to do i get this message:

"The variant could not be deleted. This is because the variant was used in an order or in the shopping cart. It was therefore disabled."

We want the content manager to be able to changes the variants without these problems.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on June 11, 2015 17:34

You can get the shopping carts that are only related to the orders then, and delete those out. First you would get all of the orders, then get the shoppings carts and remove them using the above method.

ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(OrderID)

0 votesVote for this answer Mark as a Correct answer

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