WooCommerce: change related products image size

Many of you asked me how to change the size of the related products displayed on the product page in WooCommerce. Most of the time, adding a little CSS snippet does the trick, but in some cases you would need to use a PHP snippet to be sure that your dimensions are taken into account. For some reason adding CSS to style.css isn’t always enough, so in that case using a few lines of PHP to add CSS code within the page source code directly is necessary. To do so, we’ll need to use the wp_footer hook.

All you have to do is to paste the following code in your functions.php file in your theme’s folder:

9 responses to “WooCommerce: change related products image size”

  1. brycead

    Nice one Remi! :)

  2. Awesome Remi!

    The conditional approach is my preferred method.

  3. watchteller

    Boom! function.php will full of your snippets.

    Thanks. ^.^

  4. […] “ähnliche Produkte” wieder zu beseitigen, hat das Einfügen von PHP und HTML Code von Remi Corson in die functions.php des aktiven Themes zu den gefürchteten White-Screens geführt; d.h. alle […]

  5. javo

    Hi there. I´m having a problem with my related products. I did what you say for change related products image size but it keeps showing me jus three products. I tough this was because there was no room for more products but once that I made them smaller, there are just 3 in each row. I put in the code that I need 6 products and 1 row but is no working.
    You can check this here: http://www.finessefinejewelry.com/shop/?product=flower-ring-with-diamonds
    Please help…
    Thanks.

  6. sha123

    Hi Remi, May I know how to use this function to change the sizes of videos instead of images ? I’m using the “featured video plus” plugin to upload the featured video, but I cannot change the sizes from there? Kindly assist me to fix this? Thanks a lot in advance

  7. leighross

    HI,
    I followed this recommendation and now I have no site!! Can you help me get it working again? http://www.nativeimpressionsart.com

  8. fistukidz

    hi,
    can you have us with the same thing for upsell products?
    the images are too big (if we change the size in appearance then the image size is smaller but the container is still big)
    we also have a problem with single product image size we want to set a maximum height so the image will not pass a specific height and then if needed it will reduce/sharing the width. (hope its clear)

    thanks.

Leave a Reply