Skip to content

Snippet: Disable WooCommerce Product Gallery Auto Height

By default the WooCommerce product slider will move up and down to match the height of the currently displayed picture. You can disable this by hooking into the "woocommerce_single_product_carousel_options" filter and setting the "smoothHeight" option to false.

/**
 * Disable WooCommerce Product Gallery Slider Auto Height.
 *
 * @link https://total.wpexplorer.com/docs/snippets/disable-woocommerce-gallery-auto-height/
 */
add_filter( 'woocommerce_single_product_carousel_options', function( $options ) {
	$options['smoothHeight'] = false;
	return $options;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top