Guide

How to find JavaScript errors on your WooCommerce checkout

JavaScript errors happen in your shoppers' browsers, and WordPress never hears about them. How to find the ones on your checkout, read whose they are, and fix the ones that cost sales.

Updated

The short answer

JavaScript errors happen in your shoppers' browsers, and WordPress never hears about them. To find them:

  • open the checkout yourself with the browser console open, and on a phone through remote debugging;
  • read each error's file to see which plugin, theme or service it came from;
  • ignore what comes from browser extensions, and fix what sits on the cart and checkout first.

That shows the errors your own browser hits. To see the ones your customers hit, the store has to collect them from real visits.

Why you don't see them

The logs in WooCommerce and WordPress record what happens on your server: PHP errors, payment gateway messages, failed scheduled tasks. A JavaScript error happens in the shopper's browser. It may stop the Place order button, a shipping calculator or the payment form, and the only record of it is a line in a console nobody opens.

That is why a broken checkout so often surfaces as “sales are down this week” rather than as an error: the shopper sees a button that does nothing and leaves.

Finding them yourself

  1. Open your store in a private window, so you see what a logged-out shopper sees, and open the developer tools (right-click → Inspect → Console).
  2. Walk the purchase: a product page, add to cart, the cart, the checkout. Change the shipping country, pick each payment method, and press Place order with a test payment. Errors appear in red as they happen.
  3. Repeat on a phone with remote debugging — Safari's Web Inspector for an iPhone, chrome://inspect for Android. Many checkout faults are mobile-only.
  4. Repeat after every update to WooCommerce, a plugin, the theme or an optimisation setting — that is when most new errors arrive.

Reading an error

Each error names a file. The file is usually enough to tell whose it is:

  • /wp-content/plugins/<name>/… — that plugin. /wp-content/themes/<name>/… — the theme.
  • /wp-content/plugins/woocommerce/… — WooCommerce's own script, but the cause is often another plugin that changed the page it expected.
  • A file on another domain — a payment provider, a chat widget, a review service, an analytics tag.
  • chrome-extension:// or similar — the shopper's browser extension. Nobody at the store can fix these.

Some messages come up again and again on WooCommerce stores:

  • jQuery is not defined or $ is not a function — a script ran before jQuery loaded, usually because an optimisation plugin deferred or delayed jQuery.
  • Cannot read properties of null / undefined — a script looked for an element that isn't there, often after a theme or checkout layout change.
  • Script error. — a script from another domain failed and the browser hid the details. Add crossorigin="anonymous" to its tag to see them.
  • Failed to load resource — a script, stylesheet or image did not load: blocked, moved or returning an error.

Which errors matter

A busy store produces a steady trickle of harmless errors. Put first the ones that are:

  • on the cart or checkout pages;
  • from your own theme, your plugins or your payment provider, not from extensions or tracking tags;
  • followed by the shopper leaving, or by the same click repeated;
  • new since the last update, or suddenly much more frequent.

Collecting them from every visit

Checking by hand shows the errors in your browser, today. StorePilot collects them from every shopper's browser, all the time:

  • Grouped into issues, so one bug hit by two hundred shoppers is one line, with the pages, browsers and number of people it reached.
  • Whose it is — your shop, a payment provider, another service, or the visitor's browser — decided for each issue. The list opens on your shop's and payment issues, the ones you can act on.
  • What it affects — an issue that sat on an unpaid cart's checkout, or came from a payment provider, is marked as blocking a purchase.
  • The steps before it and the recording of the visit, so you see the click that triggered it without reproducing it yourself.
  • “Script error.” comes with the list of scripts on that page missing the attribute that would have shown the details.

Install the WordPress plugin, see how error tracking works, or read the error tracking docs.

FAQ

Questions about this guide

Does WordPress or WooCommerce log JavaScript errors?

No. WooCommerce → Status → Logs and the PHP debug log record what happens on your server. JavaScript runs in each shopper's browser, and its errors stay there unless something on the page collects them and sends them back.

How do I see JavaScript errors on my phone?

Connect the phone to a computer and use remote debugging: Safari's Web Inspector for an iPhone (switch it on under Settings → Safari → Advanced) or Chrome's chrome://inspect for Android. The phone's console then opens on the computer.

What does "Script error." with no details mean?

A script loaded from another domain threw an error, and the browser hid its details on purpose. Adding crossorigin="anonymous" to that script's tag — with the other server allowing it — makes the next error arrive with its real message and file.

Should I fix every JavaScript error on my store?

No. Errors from browser extensions or a tracking pixel rarely affect a purchase. The ones to fix first are on the cart and checkout pages, come from your own theme, plugins or payment provider, and happen just before a shopper stops.

See the errors your shoppers see

Install the plugin, and every JavaScript error on your store arrives grouped, with whose it is and what it blocked.

Start for free

Every feature on the Free plan, for 100 visitors a month. No card required.

Choose a plan

Plans from €29 a month, priced by your monthly visitors and the websites you connect.