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 class="my_image" src="/wp-content/uploads/your-image-path.jpg" alt="your-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.

5 1 vote
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Rams
Rams
July 18, 2020 12:58 am

Hello John

Thank you for your code. The code as it is not working. I replaced the function “add_action” with “add_filter”. Then it is perfectly working.

Kind Regards
Rams

Fabrizio Micciche
September 16, 2021 1:10 am

It worked perfectly!! Thanks

Rodrigo
September 29, 2022 10:10 am

Works fine in sep-2022 thanks a lot for sharing <3

4
0
Would love your thoughts, please comment.x
()
x
Scroll to Top