fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Ajax behavior stops

Dear Support,

I am using this plugin (Variation Swatches for Woocommerce) in my custom Theme. when I activate this plugin and enable AJAX behavior (Enable AJAX add to cart buttons on archives ) Site does not behave well. Ajax behavior is not working.

Actually I found the incompatibility. I have included Jquey like below in my functions page.
wp_enqueue_script( ‘jquery-js’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js’);

If I remove the above code it work s fine.

But JQuery is essential for the theme. How can I get the Ajax behavior in my website.

 

Thanks

Golam Kibria

Hi Sahan,

I hope that you are doing great.

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’);

Hopefully, this should help you resolve the issue.

We will wait for your feedback.

Thanks a lot