Home » WooCommerce: Display Content Above Add to Cart @ Single Product Page

WooCommerce: Display Content Above Add to Cart @ Single Product Page

by Tutor Aspire

A client of mine decided to add a little notice (“30-day return policy offered”) just above the Add to Cart button on the WooCommerce single product page. There is no need to say this will allow her to increase the click-through rate and her sales conversion rate.

So, how to do this? Once again, it’s very simple. Just copy/paste the following snippet in your functions.php template file:

The PHP snippet to show text above Add to Cart:

/**
 * @snippet       Adds notice at single product page above add to cart
 * @how-to        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=349
 * @author        Tutor Aspire
 * @testedwith    WooCommerce 3.4.5
 */

add_action( 'woocommerce_single_product_summary', 'tutoraspire_show_return_policy', 20 );

function tutoraspire_show_return_policy() {
    echo '

30-day return policy offered. See Terms and Conditions for details.

'; }

The CSS customization

As you may have noticed, the HTML paragraph tag has an “id” so that you can style it via CSS. In my example I wrote this in the custom.css file:

.rtrn {
text-align: center;
font-style: italic;
}

Here’s the WooCommerce snippet final result:

WooCommerce: add notice @ single product page
WooCommerce: add notice @ single product page

You may also like