Reputation: 13
In Woocommerce I am using the following code to add a custom text under add to cart:
add_action( 'woocommerce_after_add_to_cart_button', 'content_after_addtocart_button_func' );
function content_after_addtocart_button_func() {
// Echo content.
echo '<div style="font-size:10px;"><em>(*Contact us for bulk purchase enquiry)</em></div>';
}
But It is displayed in one line like in this screenshot:
How can I have it under the add to cart button?
Upvotes: 1
Views: 507
Reputation: 254492
You can try use a <br slyle="clear:both;">
that has a slyling clear
argument set to both
, to stop the floating styling behavior:
add_action( 'woocommerce_after_add_to_cart_button', 'content_after_addtocart_button_func' );
function content_after_addtocart_button_func() {
// Echo content.
echo '<br slyle="clear:both;"><div style="font-size:10px;"><em>(*Contact us for bulk purchase enquiry)</em></div>';
}
It should work...
Upvotes: 0
Reputation: 3562
Just Wrape the Text with <div>
as follow:
add_action('woocommerce_after_add_to_cart_button', 'content_after_addtocart_button_func');
function content_after_addtocart_button_func()
{
// Echo content.
echo '<div>(*Contact us for bulk purchase enquiry)</div>';
}
or you can use woocommerce_after_add_to_cart_form
as follow:
add_action('woocommerce_after_add_to_cart_form', 'content_after_addtocart_button_func');
function content_after_addtocart_button_func()
{
// Echo content.
echo '<div>(*Contact us for bulk purchase enquiry)</div>';
}
Upvotes: 1