【发布时间】:2021-02-03 00:31:16
【问题描述】:
在 WooCommerce 中,我们希望在悬停时禁用产品图片缩放。我在子主题functions.php 中看到了多种选择。但它们都不起作用。
子主题 function.php 正在运行(其中有一些其他代码正在运行)。当我把它放在主题function.php文件中时它也不起作用。
我试过了:
add_filter( 'woocommerce_single_product_zoom_enabled', '__return_false' );
和
function remove_image_zoom_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );
和
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;
}
还有更多选择吗?
【问题讨论】:
-
在第二个选项中,将“wp”替换为“after_setup_theme”。您也可以尝试添加 remove_theme_support( 'wc-product-gallery-lightbox' );
标签: wordpress woocommerce