Software Developer

Disable YITH WooCommerce Zoom Magnifier on one product

Disable YITH WooCommerce Zoom Magnifier on one product is a WordPress WooCommerce plugin that lets customers zoom in on your product image.

You can disable the YITH WooCommerce Zoom Magnifier on one product or many products.

To remove it only on one product use this, and change ‘1006’ on line 3 to your product ID.

function my_theme_scripts_function() {
	
	if ( is_single( 1006 ) ) {

	 	wp_dequeue_script( 'yith-magnifier-slider' );
	 	wp_dequeue_script( 'yith-magnifier' );
	 	wp_dequeue_script( 'yith_wcmg_frontend' );
	 	wp_dequeue_style( 'yith-magnifier' );
	 	wp_dequeue_style( 'yith_wcmg_frontend' );

	}
}
add_action('wp_enqueue_scripts','my_theme_scripts_function', 12);

To remove it on multiple products, change line 3 to this, and replace the numbers with your own product IDs (post IDs):

if ( is_single( array( 333, 444, 555 ) ) ) {

By

We've 3 Responses

  1. April 1st, 2016 at 10:08 am

    Hi!

    Awesome code! Do you have an idea how to make the images non-clickable?
    Because now if you click on the image it opens in a new window and I would like to prevent this from happening.
    Thank you!

    avatar
  2. June 13th, 2017 at 12:09 am

    Hi thanks so much for this! I have a question about getting it to work..where it says “my_theme_scripts_function”, do I need to change that or leave it as it is?

    Thanks again!!

    avatar

Leave a Reply to Zohal Cancel reply

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]