John Davidson

php - Add shortcode to WooCommerce product description

0 comments
Message:


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?



My Answer:
"Add your shortcode here";_$description .= $text;_return $description;_}_add_filter('woocommerce_short_description', 'ce_add_text_short_descr');_

This code will add the specified shortcode at the end of every WooCommerce product description. Just replace "Add your shortcode here" with the actual shortcode you want to add.

Rate this post

4 of 5 based on 9006 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us