WooCommerce Show Content Under The Add To Cart Button On The Product Page

WooCommerce Single Product template showing a custom message under the add to cart button

Pre-Requisites

There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

Showing content under the add to cart button on the single product page can help you convey important messages to the customer. You may wish to display a promotion, offer, or shipping options earlier on in the buying process. Placing positive statements near call-to-actions can sometimes influence a conversion, particularly if your messaging is something like “secure checkout”, “30 day money back guarantee”, or ” most popular product”. This quick guide shows you how you can add custom content under the add to cart page. This example in particular displays a shipping notice with a Font Awesome icon.

				
					/**
* Snippet Name:     Show custom content under the WooCommerce single product add to cart button.
* Snippet Author:   ecommercehints.com
*/

function ecommercehints_content_after_add_to_cart_form() {
    echo '<span id="undercartcontent">FREE UK POSTAGE <i class="fas fa-truck"></i></span>';
};

add_action( 'woocommerce_after_add_to_cart_form', 'ecommercehints_content_after_add_to_cart_form', 10, 0 );
				
			

Snippet Benefits

  • Notify customers of any deals or promotions
  • Let customers know shipping options
  • Place positive messaging to influence an add to cart click
  • Add literally and content you like under the add to cart button on the WooCommerce single product page
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

2 Responses

  1. Hey guys! Thanks for the code 🙂 is there a way to code it so that the text is bigger underneath the cart button on a mobile?

    Many thanks

    1. Hey Emma!

      We’ve updated the code snippet – specifically we’ve assigned the custom content a span ID.

      This means the custom content can be targetted using custom CSS.

      Use this new code snippet then simply add to your single product template the following CSS:

      #undercartcontent {
      font-size:25px;
      }

      Let us know how you get on and anything else you need help with!

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

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

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers