fbpx
Enjoy Year-End Sale: 50% Off All Plugins! Coupon Code: NewYear2025

Javascript loading on all Pages

Jozef koko

Hello Team

As you can see on this page: link

when I pick the variable that I configure using a plugin it

As you can see here the conflict that occurs https://prnt.sc/doi5HH4KpwO1

I have an issue with your plugin, which loads JavaScript on all the pages.

Could you find me how to load the javascript only for the product pages ONLY?

Best regards

Jozef

 

 

Golam Kibria

Hi Jozef,

Please add the following snippet to your child theme’s functions.php file:
add_action( 'wp_enqueue_scripts', function(){
if( !is_product() ){
wp_dequeue_style( 'woo-variation-swatches' );
wp_dequeue_script( 'woo-variation-swatches' );
}
}, 99 );
Let me know if this helps resolve the issue.

Thank You

Jozef koko

I am waiting for the solution for the issue

is there any updates?

Best regards

Jozef

Golam Kibria

Hi Jozef,

Did you add the suggested snippet to your child theme’s functions.php file?

If not, please add the following snippet to your child theme’s functions.php file.

add_action( 'wp_enqueue_scripts', function(){
if( !is_product() ){
wp_dequeue_style( 'woo-variation-swatches' );
wp_dequeue_script( 'woo-variation-swatches' );
}
}, 99 );

You can also use the Code Snippets plugin to add it.

I will wait for your feedback.

Thank You