title: Add a Thumbnail to Group Product Image in Woocommerce
body: <p>Currently woo commerce only offers the product name and quantity box. Some of my products are a different color or style. I would like the customer to be able to see a thumbnail image next to the product name that is a grouped product. Also if possible if they hover over it to see it larger.</p>
  
  <pre><code>Grouped.php file:
  
  &lt;?php
  /**
   * Grouped product add to cart
   *
   * @author      WooThemes
   * @package     WooCommerce/Templates
   * @version     2.1.7
   */
  
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  
  global $product, $post;
  
  $parent_product_post = $post;
  
  do_action( 'woocommerce_before_add_to_cart_form' ); ?&gt;
  
  &lt;form class="cart" method="post" enctype='multipart/form-data'&gt;
      &lt;table cellspacing="0" class="group_table"&gt;
          &lt;tbody&gt;
          &lt;?php
          foreach ( $grouped_products as $product_id ) :
              $product = wc_get_product( $product_id );
              $post    = $product-&gt;post;
              setup_postdata( $post );
              ?&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;?php if ( $product-&gt;is_sold_individually() || ! $product-&gt;is_purchasable() ) : ?&gt;
                          &lt;?php woocommerce_template_loop_add_to_cart(); ?&gt;
                      &lt;?php else : ?&gt;
                          &lt;?php
                          $quantites_required = true;
                          woocommerce_quantity_input( array( 'input_name' =&gt; 'quantity[' . $product_id . ']', 'input_value' =&gt; '0' ) );
                          ?&gt;
                      &lt;?php endif; ?&gt;
                  &lt;/td&gt;
  
                  &lt;td class="label"&gt;
                      &lt;label for="product-&lt;?php echo $product_id; ?&gt;"&gt;
                          &lt;?php echo $product-&gt;is_visible() ? '&lt;a href="' . get_permalink() . '"&gt;' . get_the_title() . '&lt;/a&gt;' : get_the_title(); ?&gt;
                      &lt;/label&gt;
                  &lt;/td&gt;
  
                  &lt;?php do_action ( 'woocommerce_grouped_product_list_before_price', $product ); ?&gt;
  
                  &lt;td class="price"&gt;
                      &lt;?php
                      echo $product-&gt;get_price_html();
  
                      if ( ( $availability = $product-&gt;get_availability() ) &amp;&amp; $availability['availability'] )
                          echo apply_filters( 'woocommerce_stock_html', '&lt;p class="stock ' . esc_attr( $availability['class'] ) . '"&gt;' . esc_html( $availability['availability'] ) . '&lt;/p&gt;', $availability['availability'] );
                      ?&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;?php
          endforeach;
  
          // Reset to parent grouped product
              $post    = $parent_product_post;
              $product = wc_get_product( $parent_product_post-&gt;ID );
              setup_postdata( $parent_product_post );
          ?&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  
      &lt;input type="hidden" name="add-to-cart" value="&lt;?php echo esc_attr( $product-&gt;id ); ?&gt;" /&gt;
  
      &lt;?php if ( $quantites_required ) : ?&gt;
  
          &lt;?php do_action( 'woocommerce_before_add_to_cart_button' ); ?&gt;
  
          &lt;button type="submit" class="single_add_to_cart_button btn btn-flat"&gt;&lt;?php echo apply_filters( 'add_to_cart_text' , $product-&gt;single_add_to_cart_text() ); ?&gt;&lt;/button&gt;
  
          &lt;?php do_action( 'woocommerce_after_add_to_cart_button' ); ?&gt;
  
      &lt;?php endif; ?&gt;
  &lt;/form&gt;
  </code></pre>
  
  
  
  <p>Found this but doesn't seem to work</p>
  
  <pre><code>add_action( 'woocommerce_grouped_product_list_before_price', 'woocommerce_grouped_product_thumbnail' );
  
  function woocommerce_grouped_product_thumbnail( $product ) {
  $image_size = array( 20, 20 );  // array( width, height ) image size in pixel 
  $attachment_id = get_post_meta( $product-&gt;id, '_thumbnail_id', true );
  ?&gt;
  &lt;td class="label"&gt;
      &lt;?php echo wp_get_attachment_image( $attachment_id, $image_size ); ?&gt;
  &lt;/td&gt;
  &lt;?php
  }
  </code></pre>