user8756001
user8756001

Reputation: 31

Add custom text below Add To Cart button in WooCommerce single product pages

So I have attached an image of my issue.

The code is right up on the button

Basically I followed the instructions on this Stack Overflow question thread right here:
Text under Add to cart (woocommerce)

I posted my question there 5 times and someone kept removing it, so I'm posting it again here. Please advise.

Update: I have already tried the paragraph tag, the break tag, and the pre tag.

Upvotes: 3

Views: 5123

Answers (2)

Kashiii
Kashiii

Reputation: 47

This code will place it nicely below the Add to Cart button :

add_action( 'woocommerce_after_add_to_cart_form','content_after_addtocart', 100 );
  function content_after_addtocart() {
  // place your content below.
  echo 'Hello There !!';

   }

Upvotes: 0

LoicTheAztec
LoicTheAztec

Reputation: 254491

You could try this (as you will see this is a CSS styling issue with the margin-top):

add_action( 'woocommerce_after_add_to_cart_button', 'custom_content_after_addtocart_button', 100 );
function custom_content_after_addtocart_button() {
    // custom content.
    echo '<br/><div><p style="font-size:10px; font-style=italic; margin-top:20px;">(*Contact us for bulk purchase enquiry)</p></div>';
}

Code goes in function.php file of your active child theme (active theme or in any plugin file).

Tested and works. You will get that:

enter image description here

Upvotes: 1

Related Questions