Noel asked this 4 years ago

Add global text in woocommerce product template

I want to add a global text that shows up on all products (not edit the product and add manually), is there a way without altering product template?


Best Answer by guruprakash 4 years ago

If you want it exactly after short description this is better:

 add_filter('woocommerce_short_description','myglobal_short_descr');
function myglobal_short_descr($sdescription)
{ 
   $text="Global Text Goes Here";
   return $sdescription.$text;
}
functions.php
mohlal 4 years ago
1 like

Add this to functions.php of your theme


add_action( 'woocommerce_before_single_product', 'add_text_after_excerpt_single_product', 25 );
function add_text_after_excerpt_single_product()
{    global $product;   
 // Output your custom text    
  echo 'Global Text Goes Here';
}