How to add thumbnails to grouped products in WooCommerce

WooCommerce group products is a product type that lets you add some simple products to a single parent product. This allows your visitor to add products from a range (or few ranges), to their cart on the same page instead of jumping between product pages to do so.

The “problem” with these grouped products, however, is that, by default, only the product name and a quantity input box is shown, like so:

Some folks would like to have that show the thumbnails, too! And, you can! The following piece of code will add the thumbnails to grouped products in WooCommerce so that it looks like this:

add_action( 'woocommerce_grouped_product_list_before_price', 'wc_grouped_product_thumbnail' );
function wc_grouped_product_thumbnail( $product ) {
    $image_size = array( 120, 120 );
    $attachment_id = get_post_meta( $product->get_id(), '_thumbnail_id', true );
    $link = get_the_permalink( $product->get_id() );
    <td class="label">
        <a href="<?php echo $link; ?>" > <?php echo wp_get_attachment_image( $attachment_id, $image_size ); ?> </a>

You can add this code to your site following the instructions here:

How to add custom code to your WooCommerce/WordPress site the right way

Have any feedback? Be sure to let me know here: Contact me

8 thoughts on “How to add thumbnails to grouped products in WooCommerce

    1. change
      add_action( ‘woocommerce_grouped_product_list_before_price’, ‘wc_grouped_product_thumbnail’ );
      add_action( ‘woocommerce_grouped_product_list_before_label’, ‘wc_grouped_product_thumbnail’ );

  1. any idea on how to add a category dropdown at the top of that grouped.php (to be just under header, no sidebar)

  2. It’s really a nice and useful piece of info.

    I am satisfied that you simply shared this useful information with us.
    Please stay us informed like this. Thank you for sharing.

  3. I just much more tried and worked! Thank you so much. I need to know how to show thumbnails image left side

Share your thoughts

Your email address will not be published. Required fields are marked *