I am trying to auto-add some shortcode at the end of every woo product description. (not after short description). The code with which I am trying is:
add_filter('product_descr','ce_add_text_short_descr');
function ce_add_text_short_descr($description){
$text="[my-shortcode-goes-here]";
return $description.$text;
}
That one is not working for me. can someone help me?
2
Answers
You are making mistake with woocommerce hook and if we neeed to print a shortcode in a php file it works with do_shortcode(); Hope it will work on your side I have already tested it.
Don’t forget to replace my-custom-text with your shortcode.
This way using the hook
the_content
you can update the product description using the shortcode