0

I have a few products with no images but they template leaves a big empty space where the image should be, I was wondering if there was a way to hide this product gallery section only IF there are NO images uploaded to that product.

Thanks Badger

1 Answer 1

1

WooCommerce adds classes to indicate when a product has a thumbnail specified, so you can address this with CSS.

.product .images { display: none; } /* hide images div by default */
.product.has-post-thumbnail .images { display: block; } /* show images div when thumbnail is present */
3
  • 1
    Fantastic, thanks so much, I had not noticed that at all :) Jul 19, 2014 at 14:08
  • Where do I put this?
    – c0dehunter
    Feb 8, 2018 at 14:50
  • @PrimožKralj stylesheet of the active child theme or a custom CSS plugin, etc. Nov 20, 2018 at 15:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.