Petar Vasilev
Petar Vasilev

Reputation: 4735

Can't remove WooCommerce's image zoom

I am trying to remove the image zoom from my custom themed website which uses WooCommerce. Here is what I've tried adding in my functions.php file:

add_action( 'after_setup_theme', 'remove_pgz_theme_support', 100 );

function remove_pgz_theme_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}

and this

add_action( 'wp', 'remove_pgz_theme_support', 20 );

function remove_pgz_theme_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}

I've spend some time googling but the answers always recommend trying something along the lines of the above.

Upvotes: 3

Views: 3009

Answers (2)

Tobias
Tobias

Reputation: 1564

I disable all image effects with:

add_action('wp', 'remove_woo_image_effects');
function remove_woo_image_effects() {

    // this should be disable the gallery slider and lightbox
    remove_theme_support('wc-product-gallery-lightbox');
    remove_theme_support('wc-product-gallery-slider');

    // this should be disable the zoom
    remove_theme_support('wc-product-gallery-zoom');
}

I tested it with DIVI and two from my custom themes
checked it here with custom theme

Upvotes: 5

Petar Vasilev
Petar Vasilev

Reputation: 4735

The solution that worked for me is adding the following to your functions.php file

// Add WooCommerce support
function add_woocommerce_support() {
    add_theme_support( 'woocommerce' );
}

add_action( 'after_setup_theme', 'add_woocommerce_support' );

Upvotes: 2

Related Questions