fbpx
Want To Add Extra Images Per Product Variation? Download This Free Plugin

Variation swatches causing JS errors

Hello, I am in chat with another WOO support. They are saying that the variation swatches plugin is causing JS errors. They wanted to me get in contact with you.

For reference:

Request #9227762

Hakik Zaman

Hi Cory,

Thanks for reaching out to us.

You seem to be experiencing the issue due to a conflict of multiple jQuery versions.

On your site, additional jQuery is being added – https://paste.pics/acf8a02f0427bf4f7c8beab69ec2446e

WordPress Core already offers jQuery by default so, you don’t need to enqueue it again from a CDN.

Here is a default list of JS libraries that WP offers:
https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-and-js-libraries-included-and-registered-by-wordpress

You can enqueue the built-in jQuery library like this:
wp_enqueue_script( 'jquery' );

Rather than:
wp_register_script( 'jquery', 'https://code.jquery.com/jquery-3.4.1.js');

Our plugin uses the built-in jQuery library of WordPress. Please remove the additional CDN for jQuery.

This should resolve the issue.

Hope to hear from you soon.

Thanks a lot