Noel asked this 5 months 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?


guruprakash 5 months ago
2 likes

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 5 months ago

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';
}