Skip to content

Instantly share code, notes, and snippets.

@corsonr
Last active January 19, 2021 12:16
Show Gist options
  • Save corsonr/3ac30cc334cf344dbb3b to your computer and use it in GitHub Desktop.
Save corsonr/3ac30cc334cf344dbb3b to your computer and use it in GitHub Desktop.
WooCommerce: change related products image size
<?php
add_filter( 'wp_head' , 'related_products_style' );
function related_products_style() {
if( is_product() ) :
?>
<style>
.woocommerce .related ul.products li.product, .woocommerce .related ul li.product, .woocommerce .upsells.products ul.products li.product, .woocommerce .upsells.products ul li.product, .woocommerce-page .related ul.products li.product, .woocommerce-page .related ul li.product, .woocommerce-page .upsells.products ul.products li.product, .woocommerce-page .upsells.products ul li.product {
width: 24% !important;
}
</style>
<?php
endif;
}
@SybridMD
Copy link

Hi there. I am having issue with the related products image sizing... some of the products shown under related products slider are very bigger in size and some shown normal. this destruct the site overall look very badly. Any idea how to fix it.
related products error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment