WordPress

Debug JavaScript Errors in WordPress with Browser Console

· Updated Apr 5, 2025 · 4 min read

Sometimes, your WordPress or WooCommerce site just stops behaving. Menus don’t expand, buttons stop working, or the media uploader refuses to open. It’s frustrating, and in many cases, the root cause is a JavaScript error.

The good news? You don’t need to be a developer to find the error. Your browser already has the tools to help you diagnose the issue, and once you know where to look, you’ll be better equipped to troubleshoot or ask for support the right way.

Here’s a simple step-by-step guide to finding and reporting JavaScript errors on your WordPress site.

Step 1: Check in Another Browser First

Before diving in, open your site in a second browser (e.g. try Firefox if you’re using Chrome). Why?

Take note of which browsers are affected, this will help later if you reach out for support.

Step 2: Enable SCRIPT_DEBUG in WordPress

To make sure you’re loading the uncompressed versions of JavaScript files (which are easier to debug), you’ll need to enable SCRIPT_DEBUG.

  1. Open your site’s wp-config.php file.

  2. Add this line before the line that says “That’s all, stop editing!”:

define( 'SCRIPT_DEBUG', true );

Now reload your site and check if the issue is resolved.

Step 3: Use Developer Tools to Identify the Error

All modern browsers come with built-in developer tools. Here’s how to access them:

In Chrome:

In Firefox:

In Safari:

In Edge or Internet Explorer:

Step 4: Look for the Error

Once the Console tab is open:

Common ones include:

Click the error to see where it happened - it will usually show you the file name and line number, like this:

jquery.js:2 Uncaught TypeError: Cannot read property 'x' of undefined

Step 5: Take a Screenshot or Copy the Error

This is the most important part if you’re contacting support. Here’s what to include in your message:

If you’re contacting WooCommerce support, support agent often ask for this info when troubleshooting issues with things like the checkout, payment buttons, or the product editor.

Bonus: What If You See jQuery is not defined?

This one’s common, and usually means:

There’s a dedicated guide on fixing this, but feel free to reach out if you’re stuck, and be sure to include the console message.

Final Tips

JavaScript issues can be frustrating, but catching them early (and understanding what’s going on) gives you a big head start. Whether you’re building a custom theme or just running a busy WooCommerce store, using the browser console is a simple but powerful way to stay in control.

Need help understanding a console error? Share it in the comment - I’m here to help.

Shameem Reza
Written by Shameem Reza

I am a Happiness Engineer at Automattic, helping merchants turn WooCommerce chaos into calm with clear solutions and simple technical breakdowns.

Enjoyed reading this?

This site stays ad-free and independent. If something here saved you time or taught you something new, a coffee goes a long way.

Buy me a coffee ☕
Keep reading