SagePay, OneStepCheckout, 'Transaction could not be cancelled and order was not created, cart was modified while customer on payment pages'

I spent this morning dealing with a Magento sit that was unable to process Credit Card payments when they were placed with SagePay.

When a customer tried to place an order they were able to enter that card details, but were then presented with an alert with the following message

Your order could not be completed, please try again. Thanks.

They were using the EbizMarts SagePay CE Module, so I had a look around to see if the error was known

It appears that a recent release of the SagePay Module introduces some additional checks before creating the order and the current release of the OneStepCheckout is not compatible with this.

If you look straight at the SagePay Logs you may also see the following errors, which may indicate the same problem.

Thankfully there is a simple fix for this. In the app/code/local/Idev/OneStepCheckout/controllers/IndexController.php file you need to add the following line to the indexAction method

Mage::getSingleton('checkout/session')->setCartWasUpdated(false);

Just before

$this->loadLayout();

and then everything will work correctly.


Tags: SagePayOneStepCheckoutBugsProblemsSolutions