Magento’s checkout is built almost entirely in JavaScript. When one script fails, the page usually does not show an error. It just stops: the shipping methods never load, the payment form never appears, or the “Place Order” button does nothing. Customers assume the store is broken and leave.

Step 1: reproduce it with the console open

Open the store in a private window with the browser’s developer tools on the Console tab. Add a product and go through checkout, trying each payment method and a few shipping countries. Checkout errors are often specific to one method or one country.

Step 2: read the error

  • “Script error for …” or “Unable to resolve module” (RequireJS): a JavaScript file is missing or loads in the wrong order. Static content may not be deployed, or a module’s requirejs-config.js is wrong.
  • “$ is not a function” or “undefined is not a function”: usually jQuery loaded twice or a script running before its dependency.
  • An error naming a payment or shipping module: that extension is the cause. Disable that method so customers can still check out with the others while it is fixed.
  • Failed requests (red in the Network tab) to /rest/.../shipping-information or payment-information: the error is on the server. Check var/log/exception.log.

The Magento 2.4.7+ trap: SRI hashes

Since Magento 2.4.7, payment pages load scripts with an integrity hash from pub/static/frontend/sri-hashes.json. If a JavaScript file changes but its hash does not, for example after editing a file directly in pub/static, the browser refuses to run it. The only sign is one console message:

Failed to find a valid digest in the 'integrity' attribute

Product pages and the cart keep working, so it is easy to miss. Fix it by redeploying static content properly instead of editing files in pub/static:

bin/magento setup:static-content:deploy -f
bin/magento cache:flush

Prevent it

After every deploy, extension update or theme change, place a real test order. Better still, collect JavaScript errors from real visitors and watch checkout pages separately. Errors that only affect one browser never show up in your own testing.

Catch it automatically

MageMonitor checks for this every few minutes as part of its JS Errors monitoring, and alerts you by email, Slack or webhook the moment it appears, with the exact commands to fix it. See MageMonitor for Magento 2.

Related fixes