- This topic has 3 replies, 2 voices, and was last updated 6 years, 8 months ago by Andrew Misplon.
- AuthorPosts
- April 23, 2018 at 9:05 am #9498
Alexia JolliotParticipantHi 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 pxMany thanks
AlexiaApril 24, 2018 at 7:58 am #9515
Andrew MisplonKeymasterHi Alexia
Thanks for the wait. To make this change, download this file by right clicking and saving as:
https://purothemes.com/wp-content/uploads/2018/04/woocommerce-thumbnails.code-snippets.json
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, ); } endif; add_filter( 'woocommerce_get_image_size_gallery_thumbnail', 'ultra_woocommerce_single_gallery_thumbnail_size' );
Hope that helps 🙂
April 24, 2018 at 10:33 am #9522
Alexia JolliotParticipantHi Andrew,
This is great ! Thanks a lot for your support, as always !
Cheers,
AlexiaApril 24, 2018 at 11:00 am #9523
Andrew MisplonKeymasterSuper, glad to hear that helped 🙂
All the best.
- AuthorPosts
You must be logged in to reply to this topic.