Published: December 14, 2018
Last updated:

Magento: ‘undefined’ pop-up alert on Place order at checkout after upgrade

‘undefined’ alert pop-up is shown after click on Place Order button at Magento checkout page after Magento upgrade:
undefined-javascript-alert-checkout-magento

Cause

Most likely cause is missing form_key attribute in the order form.

Solution

Check app/design/frontend/yourpackage/yourtheme/template/checkout/onepage/review.phtml and app/design/frontend/yourpackage/yourtheme/template/checkout/onepage/review/info.phtml files and replace the following code:
echo $this->getUrl('checkout/onepage/saveOrder');
with
echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey()));


Do not forget to Flush Magento cache after the changes.

If the issue persist, or form_keys are in place already, to troubleshoot the problem further edit skin/design/frontend/package/theme/js/opcheckout.js in your theme, search for alert(msg); string and add alert(transport.responseText); in front of it:
alert(transport.responseText);
alert(msg);
It will show the source of unexpected response from server.

If you have any difficulties with solving this problem or got a similar one, please let us know in comments below, so we can find the solution together.

Posted in: Magento Maintenance

46 votes, 4.93 avg. rating (98% score)