Shopping Cart is clearing if user goes back to site before paying

Mark Dowding asked on November 3, 2017 19:07

Hi,

I have inherited a Kentico site that uses the built in eCommerce features. A user can go through the cart steps then back again etc and review orders. However once a user click's the button that takes the user to the payment providers hosted screens the shopping cart is emptied. Meaning that if they decide to go back to the site before submitting their payment details they have lost their shopping cart items.

I have found the call in the shopping cart that makes the call to clean the shopping cart, what is the preferred way to ensure that the basket is cleared after payment has been successful therefore allowing a user to navigate back to the shopping cart. I can see the confirmation screen in Kentico but I cannot find the code in the solution so I am guessing this is inaccessible.

I hope this all makes sense.

Thanks,

Mark.

Recent Answers


Peter Mogilnitski answered on November 3, 2017 21:59

I think this a default way: when you redirect user (at the end of the checkout process) to a payment provider (i.e. Paypal or something), In ProcessPayment Method you clear shopping cart and create and an order and you pass orderid it to the provider. So clearing shopping cart when a payment processing starts no matter what the outcome of payment processing is. So it is normal to return to empty shopping cart if you decide not to pay, cancel payment.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 4, 2017 18:35

This is not only standard shopping cart functionality, it's how Kentico's shopping cart functions as well. When you go to pay for your items by clicking Checkout, it converts the shopping cart items into an order so the order can be processed by the payment provider.

Unfortunately, it seems the cart is taking the user to another page to do this so what you could do is move the actual payment provider to the same page and when the click the "pay now" button, it will create the order and process the payment then you won't have any issues.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on November 6, 2017 14:10

Depending on how much you customized but you can create a shopping cart from your order using.

CMS.Ecommerce.ShoppingCartInfoProvider.GetShoppingCartInfoFromOrder(int OrderID)

This will return a shopping cart object. From which you can recreate your unfinished order.

I must say this is a tricky one. I'm not sure how much changed since K8, but it's not the case of just calling this one method and convert everything back.

0 votesVote for this answer Mark as a Correct answer

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