How to get rid of the hover zoom in WooCommerce single products

This is possible using woocommerce_single_product_zoom_enabled dedicated filter hook:

add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' );

Code goes in functions.php file of your active child theme (or active theme). Tested and work.


It is possible using woocommerce_single_product_zoom_enabled dedicated filter hook.

The hook undocumented available parameters in the options array are:

$zoom_options = array (
    'url' => false,
    'callback' => false,
    'target' => false,
    'duration' => 120, // Transition in milli seconds (default is 120)
    'on' => 'mouseover', // other options: grab, click, toggle (default is mouseover)
    'touch' => true, // enables a touch fallback
    'onZoomIn' => false,
    'onZoomOut' => false,
    'magnify' => 1, // Zoom magnification: (default is 1  |  float number between 0 and 1)
);

Usage with woocommerce_single_product_zoom_options filter hook:

1) Disable the zoom:

add_filter( 'woocommerce_single_product_zoom_options', 'custom_single_product_zoom_options', 10, 3 );
function custom_single_product_zoom_options( $zoom_options ) {
    // Disable zoom magnify:
    $zoom_options['magnify'] = 0;

    return $zoom_options;
}

2) Change zoom event option:

add_filter( 'woocommerce_single_product_zoom_options', 'custom_single_product_zoom_options', 10, 3 );
function custom_single_product_zoom_options( $zoom_options ) {
    // Changing the zoom event option:
    $zoom_options['on'] = 'click';

    return $zoom_options;
}

Code goes in functions.php file of your active child theme (or active theme). Tested and work.

Related: Adjusting product image’s Zoom magnification factor in woocommerce 3

Leave a Comment

tech