woocommerce offtopic – add custom css class to product images

If it is still relevant, you can add a category to the product thumbnail in the following way.

function loop_product_custom_thumbnail() {
  echo the_post_thumbnail('thumbnail', array('class' => 'your-class-name'));
}
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
add_action( 'woocommerce_before_shop_loop_item_title', 'loop_product_custom_thumbnail', 10 );

Leave a Comment