On this page
What this issue is
undefined, null and NaN (short for 'Not a Number') are values used in JavaScript and other programming languages. They are meant for developers, not visitors. When a page tries to show a value that does not exist yet, or does maths on text, the raw word is printed instead.
Typical examples: a greeting that says 'Hi undefined', a cart total of 'NaN', a product price of '$null', or a countdown that reads 'NaN days'. They come from custom scripts, page builder widgets, form personalisation, dynamic pricing and apps that load data after the page opens.
Why it costs you leads or sales
Visitors read these words as 'this site is broken'. If the error sits next to a price, a form or a button, people stop trusting the page and leave. It is worse on checkout pages, where trust matters most. Because the page still loads, nothing alerts you, and it can stay live for weeks.
- Ad clickVisitor lands on the product page
- Price loadsScript prints 'NaN' instead of the price
- Add to cartVisitor hesitates or leaves
- PurchaseSale never happens
A script fails to read the price, so the visitor sees NaN and leaves before the form or payment steps.
Example: illustrative numbers showing how a visible error can lower the share of visitors who move to the next step.
How to check if your site has it
Start with the pages that earn money: landing pages, pricing, cart, checkout, thank-you pages and any page with a personalised greeting or calculator.
Search the page text
Open the page, press Ctrl+F (Cmd+F on Mac) and search for undefined, null and NaN. Check the page after it has fully loaded.
Test the states
Change quantity, pick a variant, apply a coupon, switch country or currency, and open the page with and without URL parameters. Many errors only show after an interaction.
Test as a new visitor
Use a private window with no cookies and no logged-in session. Missing first-name or saved-data values often show up only here.
Check mobile and slow loads
Try a phone and a throttled connection. Values loaded late can briefly show 'undefined' before they fill in.
Open the browser console
Press F12 and look at the Console tab for red errors such as 'Cannot read properties of undefined'. They point to the script that fails.
How to fix it
The cause is nearly always one of three things: a value that is not set yet, a field that is empty, or text used in a calculation. Fix the source, and add a fallback so a missing value never shows as raw text.
| Where you see it | Likely cause | Fix |
|---|---|---|
| Hi undefined | First name is not available | Use a fallback such as 'Hi there' |
| Price shows NaN | Price text like '$1,200' used in maths | Strip symbols and commas, then convert to a number |
| Field shows null | Empty database or CRM field | Hide the element or show a default when empty |
| Shows undefined after loading | Script runs before data arrives | Wait for the data, or render only when it exists |
Find the source
Search the page in the editor and in Custom HTML blocks, shortcodes and theme files. Deactivate plugins one at a time on a staging copy to find the one that prints the text.
Fix empty custom fields
In ACF or similar plugins, make sure the field has a value or add a default. In theme code, check the value before printing it.
Check Liquid output
In Online Store > Themes > Edit code, find the section that prints the value. Use the default filter so empty values show a fallback.
Check apps
Disable recently installed apps in the theme editor's App embeds to see if one prints the error.
Review Custom HTML tags
Open Preview mode and check Custom HTML tags that write text into the page. Make sure the variables they use have a value, and set a default value on each variable.
Check CMS bindings
Make sure each bound CMS field is filled in. Set conditional visibility so an element is hidden when its field is empty.
Review custom code
Check Embed elements and project custom code for scripts that write text to the page.
Check custom values and merge fields
Confirm the custom value or contact field exists and is filled in. Where the builder lets you, set a fallback value for the field.
Check dynamic pages and Velo code
Confirm each dataset field is connected and has content. In Velo code, test a value before setting it as text.
Check code injection and blocks
Review Code Injection and Code blocks for scripts that write text. Remove or fix any that print empty values.
Guard values before printing
Check that a value exists and is a number before showing it. See the snippet below.
// Name with a fallback
const name = user && user.firstName ? user.firstName : 'there';
greetingEl.textContent = 'Hi ' + name;
// Price: clean the text, convert, and check before showing
const raw = priceEl.dataset.price; // e.g. '$1,200.00'
const value = parseFloat(String(raw).replace(/[^0-9.]/g, ''));
if (Number.isFinite(value)) {
totalEl.textContent = '$' + value.toFixed(2);
} else {
totalEl.textContent = ''; // hide rather than show NaN
}How to confirm it's fixed
- Search the page for undefined, null and NaN after it fully loads
- Repeat in a private window with no cookies
- Test every variant, quantity, coupon and currency you offer
- Test on mobile and on a slow connection
- Check the browser console shows no related red errors
- Check the page after clearing your cache and any CDN or plugin cache
Before
- 'Hi undefined, your total is NaN'
- Visitor doubts the site works
- Checkout abandoned
After
- 'Hi there, your total is $49.00'
- Fallback covers missing names
- Price is checked before it shows
How to prevent it happening again
- Give every dynamic value a default or fallback
- Test pages as a new visitor after each theme, plugin or app update
- Test calculators, pricing and personalised text with empty and unusual inputs
- Keep custom scripts in one place so they are easy to review
- Re-check key pages after any change to CMS fields, CRM fields or tag setups
How FunnelGuard handles this
FunnelGuard detects this issue only partly. It uses a text check: when you list words such as 'undefined', 'NaN' or 'null' as text that must be absent on a page, a robot visitor loads that page on its schedule and raises an alert if any listed word appears. The alert comes with a screenshot and a likely cause, after a re-check from a second region.
What it does not do: it does not scan your whole site for these words on its own, and it only checks the pages and journey steps you have set up. It will not find errors that appear only after inputs it does not make, such as a rare coupon, a specific variant or a logged-in account view, and it cannot judge whether a displayed value is correct. Note that a plain word like 'null' can also appear in legitimate text, so choose your list with care.
To cover the rest by hand, search key pages for the three words after each release, test variants, coupons, currencies and mobile, and review the console. Add your most important pages and checkout steps to a journey so the check runs there every time. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans include a 3-day free trial.
Frequently asked questions
Questions people ask
Why does my website show 'undefined'?
A script or template tried to print a value that does not exist, such as a missing first name or an empty field. The page then prints the word 'undefined' instead. Find the field or script that outputs it and add a fallback or fix the data source.
Why is my price showing NaN?
NaN means 'Not a Number'. It usually happens when code does maths on text such as '$1,200' or on an empty value. Remove symbols and commas, convert the text to a number and check it is valid before showing it.
Why does my page say 'Hi null' or 'Hello undefined'?
The personalisation could not find the visitor's name, often because they are new or came from a link without the data. Set a default such as 'Hi there' for when the name is missing.
How do I find 'undefined' or 'NaN' on my website?
Open each key page, press Ctrl+F or Cmd+F and search for undefined, null and NaN after it fully loads. Also test variants, coupons and currencies, use a private window and check the browser console for errors.
Can I hide the error text with CSS?
You can, but it is a poor fix. The value is still missing, so a price or name may be absent or wrong. Fix the source and add a fallback instead.
Can FunnelGuard detect 'undefined' or 'NaN' on my site?
Partly. If you list those words as text that must be absent on a page, FunnelGuard checks that page on schedule and alerts you if one appears. It does not scan pages you have not set up or find errors that need inputs it does not make.
Is the word 'null' always an error?
No. It can appear in normal copy, such as a name or a sentence. Check the context before treating it as a bug, and take care when adding it to an automated text check.
Related issues
- PRF-259Unrendered merge tags on page ({{first_name}}, %%name%%)Fix guide
- PRF-258Template placeholders shown ('[Company Name]', 'Your headline here')Fix guide
- PRF-257Lorem ipsum or placeholder text liveFix guide
- PRF-277Pricing table shows different price than checkoutFix guide
- PRF-263Outdated prices on landing page vs checkoutFix guide
- PRF-260'Test' or 'staging' banner on live siteFix guide