How to add content after add to cart button on single product page in woocommerce? | themelocation

How to add content after add to cart button on single product page in Woocommerce?

In this tutorial we’ll learn how to add content after add to cart button on single product page.

To achieve this you don’t need to forge and edit default template page. We can achieve this by using one of the hooks woocommerce comes with.

So, here will be my default product screen:

woocommerceNow we need to add content under add to cart button.

To do this add the following lines of code at the bottom of your theme’s functions.php file:

add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart_button_func' );

function add_content_after_addtocart_button_func() {

// Echo content.

echo '<div class="second_content">Place your content here!</div>';

}

Replace the dummy content with the content you want to place.

You can access functions.php file here:

woocommerceAfter updating the file, refresh the product page again and you’ll see your content being added under add to cart button.

woocommerceCHEERS J

4 Responses to How to add content after add to cart button on single product page in Woocommerce?

  1. Bryan Lee December 17, 2015 at 3:10 am #

    Good~ Thank you. 🙂

  2. Shendy Wilandria December 30, 2015 at 12:09 pm #

    This is what I’m looking for! Need hours to find this. Thanks a lot!

  3. rebecca September 26, 2016 at 9:15 am #

    what about adding an image (icon) under add to cart (not content as such)? what code would that be??

    I want to add secure icons (one image under add to cart)…

    Thanks

    Becky

  4. VeggieShirts November 8, 2016 at 12:07 am #

    Thanks! We included Social-Buttons and a good (psychological) sentence under the “Add to cart”. The Social-Buttons are made by hand, so no tons of loading scripts from facebook, twitter & co will be loaded.

    Thanks again!

Leave a Reply