How to Add an Image Below Add to Cart on Woocommerce Product Page

In this tutorial, I will show you how to add an image below the add to cart button on the product page in Woocommerce. This can be a useful snippet to use for showing images such as security seals or payment options. You can see that I have used it on this site to show accepted payment methods.

 

/*
* Snippet Show image below add to cart button on product page
* how-to Read at https://wcsuccessacademy.com/?p=270
* source code https://wcsuccessacademy.com/?p=270
* author John Cook
* tested with WooCommerce 3.3.3
*/

add_action ( 'woocommerce_single_product_summary', 'add_my_special_image', 40 );
  function add_my_special_image() {
      global $product;
    print '<img src="https://yoursite.com.au/wp-content/uploads/your-image-path.jpg" alt="your-image" class="my_image" />';
  }

 

This is how it will look on the product page

 

Where to place this code?

Place this code snippet to add an image below add to cart in Woocommerce at the bottom of the theme functions.php file (before “?>” if you have it). I strongly recommend making a copy of the file before making changes so that you can quickly revert back to the original should something undesirable happen. Alternatively, if you have a functions plugin, such as one of these found here,  you can place the snippet in there.

As a side note to this snippet, you can place the image elsewhere in the product summary area by changing the number located that the end of the add_action line. A lower number will place it higher on the page and a higher number will place it lower on the page.

Did it work for you?

Please let me know if the code worked for you by leaving a comment below. Just remember to replace the yoursite image url with the url for your actual image.

Written by John Cook
I've been using WordPress for over 6 years and Woocommerce for over 4 years. In that time I have explored the depths of customizations and helped many online retailers grow and expand their business using the Woocommerce selling platform. My aim here is to help enable Woo users around the globe get even more out of their e-commerce platform of choice.