[Resolved] change the gallery Thumbnail size in woo commerce

  • Author
  • #9498

    Alexia Jolliot

    Hi Andrew

    Here is the new topic.

    I’m using woo commerce and ultra premium and I would like to modify the gallery thumbnail size in the product page. I understand it can’t be done through the customizer and should be done with CSS or PHP. You suggest PHP but I have no clue how PHP works.
    I would like the image in the gallery thumbnail to keep their original aspect ratio which is : Height : 3 * width : 2 so ideally it would be 150px* 100 px

    Many thanks


    Andrew Misplon

    Hi Alexia

    Thanks for the wait. To make this change, download this file by right clicking and saving as:


    Then go to Plugins > Add New, search for and install Code Snippets. Then go to Snippets > Import and import the file.

    If you’re using a child theme and would prefer to insert the function directly into your child theme functions.php file, please find it below:

    if ( ! function_exists( 'ultra_woocommerce_single_gallery_thumbnail_size' ) ) :
     * Change the gallery thumbnail image size.
     * @link https://github.com/woocommerce/woocommerce/wiki/Customizing-image-sizes-in-3.3-
    function ultra_woocommerce_single_gallery_thumbnail_size( $size ) {
        return array(
            'width'  => 150,
            'height' => 100,
            'crop'   => 1,
    add_filter( 'woocommerce_get_image_size_gallery_thumbnail', 'ultra_woocommerce_single_gallery_thumbnail_size' );

    Hope that helps 🙂


    Alexia Jolliot

    Hi Andrew,

    This is great ! Thanks a lot for your support, as always !



    Andrew Misplon

    Super, glad to hear that helped 🙂

    All the best.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Scroll to top