Why is the cart emptied if a shopper cancels the payment, presses the back button or closes the browser window?

No items are removed from the cart by the plugin, but Magento 2 locks it when the payment is being processed. This is done to avoid malicious attacks, like a person adding more items to a cart while the payment is being processed to pay less.

A locked cart is inaccessible, so when you access the e-commerce with a locked cart it looks like you lost all your items.

Afterwards there are two scenarios that provide a bad experience:

Shopper presses the "Previous" button on AdyenHPP, issuer website, or anything else that gives Magento 2 a cancelled resultCode (NOT the browser back button)

Result: Magento 2 will cancel the order, the items of the order will be put into a new basket, and the shopper will see these and can go to the checkout again without putting the items in the basket again.

Shopper presses the back button on the browser, closes the browser window, or goes back to Magento 2 without sending anything

Result: since Magento 2 does not know that the order is cancelled, the order is still locked, along with the items.

If the shopper ends up in Magento, he will see a NEW empty cart, because the previous one is still locked, so they need to put the items in the basket again.

The locked order will be cancelled only after an OFFER_CLOSED notification reaches Magento 2, or if the merchant cancels it manually on the database. The basket won't be reset when this notification is processed.

Please note this behaviour is the same in both Magento 1 and 2.

Was this article helpful?
0 out of 0 found this helpful