Title: JavaScript Error on pages without variations
Last modified: March 26, 2018

---

# JavaScript Error on pages without variations

 *  Resolved [frederik.voordeckers](https://wordpress.org/support/users/frederikvoordeckers/)
 * (@frederikvoordeckers)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-on-pages-without-variations/)
 * On all the pages without variations, even non-shop pages, I’ll get the following
   JS error:
 * `Cannot read property 'addEventListener' of null`
 * Because it tries to bind the eventlistener to an element that is not there. Simple
   wrapping it with an if statement should fix it.
 * Screenshot of the issue:
 * [https://goo.gl/kHSzCY](https://goo.gl/kHSzCY)
 * Everything works fine on a page with a variation.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [frederik.voordeckers](https://wordpress.org/support/users/frederikvoordeckers/)
 * (@frederikvoordeckers)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-on-pages-without-variations/#post-10116933)
 * Can be closed, after further investigation found the bug in the theme.
 *  Plugin Author [RosendoLabs](https://wordpress.org/support/users/drosendo/)
 * (@drosendo)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-on-pages-without-variations/#post-10117137)
 * Great!
 * Please do mention the Theme you are running and how you solved it so that other
   users may approach the fix.
 * Please dont forget to review my plugin I really appreciate it!
 * Cheers,
    David

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘JavaScript Error on pages without variations’ is closed to new replies.

 * ![](https://ps.w.org/smart-variations-images/assets/icon-256x256.png?rev=2094600)
 * [Smart Variations Images & Swatches for WooCommerce](https://wordpress.org/plugins/smart-variations-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/smart-variations-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/smart-variations-images/)
 * [Active Topics](https://wordpress.org/support/plugin/smart-variations-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/smart-variations-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/smart-variations-images/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 2 replies
 * 2 participants
 * Last reply from: [RosendoLabs](https://wordpress.org/support/users/drosendo/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/javascript-error-on-pages-without-variations/#post-10117137)
 * Status: resolved