klaviyo form error "Cannot read property 'appendChild' of null

Userlevel 1
Badge +2

I'm having some issues with a signup form displaying on some page loads but not on others.


The issue happens at


When the form doesn't load it returns the following console error


Is anyone able to shed some light on why this may be the case and how i can resolve it?


Best answer by David To 6 May 2021, 22:04

View original

3 replies

Userlevel 7
Badge +60

Hello @mcohen33,

Thanks for sharing this experience! 

This sort of console error can typically stem from a timing issue where an embedded form snippet is trying to load before the async Klaviyo.js snippet finishes executing. In turn, this timing issue can be caused by either having multiple Klaviyo.js snippets installed on your site and/or the Klaviyo.js snippet was manually installed incorrectly. You can check to see if there are multiple Klaviyo.js snippets installed on your site by:

  1. Going to your website
  2. Viewing the Page Source or viewing the Inspector Tool
  3. Control + F (or Command + F on Mac)
  4. Search for the phrase Company_ID

If you were able to locate multiple instances of the Klaviyo.js present on your site, this may indicate that you have both the setting of Automatically add Klaviyo onsite javascript (recommended) enabled in your Shopify Integration settings and have manually installed the Klaviyo.js snippet. In this case, we would recommend only one or the other; either allow Klaviyo to automatically inject the javascript or manually installing the javascript. If you would like Klaviyo to automatically apply this Klaviyo.js snippet to your site, then leave the setting enabled while manually finding and removing this snippet from your theme file. Alternatively, if you wish to use the manually installed form of the Klaviyo.js, then we would recommend disabling this Automatically add Klaviyo onsite javascript (recommended) setting under your Integration > Shopify settings and then updating your Shopify integration. 

If you were able to locate only one set of the Klaviyo.js and had opted into manually installing the Klaviyo.js snippet, I would recommend ensuring that the javascript snippet was installed correctly at the very bottom of the theme file directly before the closing </body> tag. A refresher on how to manually install the Klaviyo.js snippet can be found in the How to Install klaviyo.js for Shopify Stores article.

Thanks for being a part of our Community!



Userlevel 1
Badge +2

Thank you David. That was very detailed advice and our issue is now fixed. Really appreciate your support!

Userlevel 1
Badge +2