Can't remove WooCommerce's image zoom

泄露秘密 提交于 2021-02-19 06:12:45

问题


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.


回答1:


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




回答2:


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' );


来源:https://stackoverflow.com/questions/50704326/cant-remove-woocommerces-image-zoom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!