Is there not a way to add to the function.php a add_filter like this:
add_filter(‘woocommerce_short_description’, ‘limit_product_short_description’, 10, 1);
function limit_product_short_description($post_excerpt)
{
if (!is_product())
{
$pieces = explode(” “, $post_excerpt);
$post_excerpt = implode(” “, array_splice($pieces, 0, 14));
}
return $post_excerpt;
}
We really want to limit the characters on the product short description
Thanks!
-
This reply was modified 4 years by
what-the.
So we are having an issue.
When adding this filter to the functions.php its not working. Is there another functions file that is created in another nested directory for the newspaper template? We want to add this filter to limit the short product description for the woo product block.
Thank you!
add_filter( ‘woocommerce_short_description’, ‘prefix_filter_woocommerce_short_description’ );
/**
* Limit WooCommerce Short Description Field
*/
function prefix_filter_woocommerce_short_description( $post_post_excerpt ) {
// make filter magic happen here…
if(! is_product() ) { // add in conditionals
$text = $post_post_excerpt;
$words = 10; // change word length
$more = ‘ […]’; // add a more cta
$post_post_excerpt = wp_trim_words( $text, $words, $more );
}
return $post_post_excerpt;
};
Hello!
Unfortunately, this will require custom work which is not covered by the support team.
For customization and other services you can contact our custom work team here: https://tagdiv.com/premium-customization-services/
Thank you for understanding!
???
What the?
Why should we have to pay for it when we originally had it working BUT YOUR UPGRADES MESSED IT UP! NOT COOL AND NOT FAIR. Please check out this link to confirm with what we are saying!
