Posted on

WooCommerce: Add Content Below the Single Product Page Images

One of the latest WooCommerce versions introduced an optimized product gallery on the single product page. If your products have multiple images and therefore use the product gallery, you might want to also add content below the gallery itself. But…

If you’re familiar with WooCommerce customization and WooCommerce hooks (and specifically the ones of the Single Product Page), you’ll know it’s now impossible to add content under the image as it used to be done with the “woocommerce_product_thumbnails” hook.

In fact, the new gallery completely replaces the default content via JQuery, including that hook. Adding content is not as easy as it used to be. So, here’s the workaround (you might want to check how it behaves on mobile or maybe completely hide this for small devices – this has been tested on desktop only).

Add content below the WooCommerce Single Product Page images

/**
* @snippet 	Add Content Below the Gallery Images @ WooCommerce Single Product
* @how-to 	Watch tutorial @ https://businessbloomer.com/?p=19055
* @sourcecode 	https://businessbloomer.com/?p=75204
* @author 	Rodolfo Melogli
* @testedwith 	WooCommerce 3.4.3
*/

// Note 1: this works on Storefront theme, might need customization for other themes
// Note 2: class "woocommerce-product-gallery" is vital for inheriting CSS float, margins and widths

add_action( 'woocommerce_after_single_product_summary' , 'bbloomer_add_below_prod_gallery', 5 );

function bbloomer_add_below_prod_gallery() {
	echo '<div class="woocommerce-product-gallery" style="background: #fdfd5a; padding: 1em 2em">';
	echo '<span>THIS IS A TEST. YOU CAN ADD TEXT, IMAGES AND ANY HTML</span>';
	echo '</div>';
}

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert, WordCamp speaker and Internet marketer, Rodolfo Melogli has worked as a WooCommerce freelancer since 2011. He helps entrepreneurs and developers overcome their WooCommerce nightmares :) Rodolfo is the organiser of WordCamp Dublin, the Dublin WooCommerce Meetup, the Dublin Ecommerce Meetup and the Dublin WordPress Meetup. He enjoys interacting with people, travelling and chasing tennis & soccer balls. Of course, he loves pizza too.

16 thoughts on “WooCommerce: Add Content Below the Single Product Page Images

  1. Dear Sir,
    I want to add some pictures (at thumbnail product) to all single products page. Please help me.

    1. Hello Trung – thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  2. Yes it works but having a positioning issue, as displayed in the example image.

    1. Hey Samuel, thanks for your comment! You might need custom CSS specific to your theme, this snippet can’t be valid for all themes ๐Ÿ™‚

  3. I have tried to add this code in my Avada child theme function.php but nothing happens ๐Ÿ™

    1. Hey Steph, thanks for your comment! Probably Avada has deep WooCommerce customization so default snippets don’t always work. Try to switch temporarily to another theme just to make sure the snippet works ๐Ÿ™‚

  4. Hi I’ve tried this and it work’s, work in the sense of it has an output… but it is different from the example image above because it is positioned below the product gallery and description.

    1. Hey Ray, thanks for your comment! Try with a “clear: left”, see comment https://businessbloomer.com/woocommerce-add-content-below-the-single-product-page-images/#comment-37054 – let me know ๐Ÿ™‚

  5. Good day. Thank you so much for this. I got it to work perfectly here: https://www.johnnieandpaw.co.za/product/pierced-pendant-resin/

    But … my question is, is it possible to hide it on a mobile phone? If you could help me with that I will be eternally grateful.

    Using Divi.

    1. Hello there and thanks for your question! Of course, you could try wrapping the inside of the function between a conditional check, and use the helpful WordPress function wp_is_mobile():

      
      function bbloomer_add_below_prod_gallery() {
         if ( ! wp_is_mobile() ) {
      	/* Rest of the original function goes here */
         }
      }
      
      
  6. When I tried this in Storefront theme it put the yellow div above the Description/Additional Information/Reviews tabs.
    This change seems like a bad regression. Maybe the solution is to add a ‘replacement’ action e.g.
    do_action(‘woocommerce_after_product_thumbnails’)
    near the bottom of templates/single-product/product-image.php.

    If you can think of a good use case for putting info under the thumbnails then I’ll happily submit a pull request.

    1. Cheers Damien!

      1) Do your products have a product gallery? This won’t work if there is only 1 featured image
      2) Did you keep the CSS class inside the PHP snippet? That gives you the float:left and aligns the div under the product gallery

      Let me know ๐Ÿ™‚

    2. 1) Yes, product image and 2 images in product gallery.
      2) Yes, CSS retained.
      Screenshot: http://i68.tinypic.com/vfvbjl.png

    3. Ah thanks Damien! Possibly the element is floating left but because there is more vertical spacing in the right columns is going there. Try either adding a short description that “pushes” the element to the left (as a test) to see if this theory is correct.

      After this simple test, maybe you can solve this by adding “clear: left” to the yellow DIV?

  7. thanks for your sharing ! this is helpful articles !

    1. Cool ๐Ÿ™‚

Questions? Feedback? Support? Leave your Comment Now!
If you're writing code, please wrap it between: [php] code_here [/php]

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.