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 ) ) ) {
Zohal
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!
Abraham
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!!
Isabel
June 17th, 2017 at 6:03 pm
You can leave that as is. If you choose to change it, that is okay as long as you change it on both lines: line 1 and 13.