-
AuthorPosts
-
February 21, 2020 at 3:48 pm #1186777
Hi guys,
I’m working on a shop for my website on which I plan to offer a range of documents.
Naturally, I’m using images that aren’t square (500x700px scaled to 387x542px), which causes a problem when (i) these images are displayed as related products (300x300px scaled to 291x291px) and (ii) in the product gallery (100x100px scaled to 120x120px). Is there a way to enforce custom dimensions in these categories that aren’t square?
Going by older posts in the forum, this should be doable – however – these posts are a few years old now; hence, the solution of how to go about this has become obsolete as WooCommerce has changed a lot over the years. Can you help me out with this?
Many thanks.
February 23, 2020 at 6:52 am #1187050Hey MadRhino,
Could you posts links to where we can see the images in question please?
Best regards,
RikardFebruary 27, 2020 at 4:34 pm #1188516Thanks for getting back to me, Rikard.
As you can see, the featured/product images look ok, but when they are included in the product gallery or displayed as a related product, the square format really looks bad – given that these are supposed to reflect document covers.In addition, is there a way to get rid of the “Add to cart” and “Show Details” footer that is added when products are displayed in the overview/shop page and as related products?
As always, your time and help will be greatly appreciated.
- This reply was modified 4 years, 8 months ago by MadRhino.
March 2, 2020 at 10:07 am #1189377Hi,
Thank you for the update.
You can adjust the thumbnail size in the Appearance > Customize > Woocommerce > Product Images panel. Set the Thumbnail cropping to Uncropped if you want to see the actual aspect ratio of the featured images.
You can also use the single_product_archive_thumbnail_size filter to influence or change the thumbnail size used in the woocommerce_get_product_thumbnail function.
Best regards,
IsmaelMarch 5, 2020 at 4:51 pm #1190495Thanks Ismael, but your first solution doesn’t seem to have any effect on the product gallery thumbnails and the second, I’m not sure that I’m able to make sense of it? Could you please be a bit more specific on how I would need to go about changing the thumbnail size using the single_product_archive_thumbnail_size filter?
Many thanks.
March 6, 2020 at 9:15 am #1190790Hi,
Thank you for the update.
The thumbnails are displaying fully in the shop page now. Did you manage to adjust the aspect ratio in the customizer? If you need more help, please post the login details in the private field.
Best regards,
IsmaelMarch 6, 2020 at 9:40 am #1190792Thanks for getting back to me Ismael,
Looks like we’e still talking about two different things.
I’m not going to use the shop page, but rather the home page on my shopping site. Either way, the product images, as they are displayed there look fine.
What I’m struggling with is the images that are used in the product gallery of each product (underneath the main product image). As you can see, they are cropped into squares of 120px x 120px each. Please see attached image below.
I’m fine with the width, but will need to increase the height of these gallery image thumbs to give them a bit more of an document-like format.Does this help to make this a bit clearer now?
Many thanks for looking into this again.
March 9, 2020 at 10:11 am #1191409Hi,
Thank you for the clarification.
You should be able to use the “woocommerce_gallery_thumbnail_size” filter to change the image size used for the gallery thumbnails.
function avf_custom_woocommerce_gallery_thumbnail_size() { return 'full'; } add_filter( 'woocommerce_gallery_thumbnail_size', 'avf_custom_woocommerce_gallery_thumbnail_size' );
Best regards,
IsmaelMarch 9, 2020 at 11:35 pm #1191662I’m sorry Ismael, but I can’t make heads or tails of your response. Where would I need to add/modify this filter? I’m sorry, but does this really need to be so difficult? Thanks.
March 10, 2020 at 3:14 am #1191683Hi,
Sorry for the confusion. You can add the code in the functions.php file of the parent theme, or the child theme if you have one already. The snippet should set the thumbnail used in the gallery items to “full”, which is the original size of the images with their actual aspect ratio.
Best regards,
IsmaelMarch 11, 2020 at 5:18 pm #1192369I’m sorry Ismael, but this doesn’t do nothing.
As per your instructions, I added the snippet to the functions.php file of my child theme, but since I’m working with a multi-site install, this may not be where the snippet needs to go. Is it?
I weeded through your forum hoping to find an answer there, but even though this seems a rather popular topic, the seemingly straightforward change of the product gallery thumbnail size in previous versions of WooCommerce seems long gone, which proves that the evolution of a theme or plugin isn’t always a good thing.
I managed to find something in the WooCommerce Docs that seems it could do the trick:
add_theme_support( ‘woocommerce’, array(
‘thumbnail_image_width’ => 200,
‘gallery_thumbnail_image_width’ => 100,
‘single_image_width’ => 500,
) );
I tried adding that, regenerated the thumbnails, but it didn’t work either.I can’t help feeling a bit frustrated over not being able to solve something this simple. I added a picture specifically outlining the issue – so where am I going wrong here. Does this really need to be so complicated and long drawn-out Ismael?
Many thanks for taking yet another look.
March 16, 2020 at 4:58 am #1193388Hi,
Sorry for the delay. The following code actually works on our end.
add_filter('woocommerce_get_image_size_gallery_thumbnail', function($size) { $size = array ( 'width' => 9999, 'height' => 9999, 'crop' => 1, ); return $size; },10, 1);
The filter should alter the default size of the _gallery_thumbnail returned by the wc_get_image_size function.
Thank you for your patience.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.