Support » Plugin: WooCommerce » Help customizing category and product pages

  • I have a price shortcode from another plugin in each product’s short description field. And I have the full description in the main field. I need to:

    1. Show the full description above the short description on each product page (I already got rid of the tab).

    Normally I’d just add an action to show the full description with woocommerce_before_single_product_summary, but I see no function for it here (just woocommerce_template_single_excerpt): I’m sure there should be any easy way to do this but how?

    2. Show the full description but limited to, say, 400 characters on the category pages for each item.

    I found:

    add_filter("the_content", "break_text");
    function break_text($text){
        $length = 500;
        if(strlen($text)<$length+10) return $text;//don't cut if too short
        $break_pos = strpos($text, ' ', $length);//find next space after desired length
        $visible = substr($text, 0, $break_pos);
        return balanceTags($visible) . " […]";

    But obviously that limits the content everywhere. I’m not sure how to only apply it to products on category pages. Or again if there’s a much easier way to do this.

    Anyone can give me pointers? Thanks.

  • The topic ‘Help customizing category and product pages’ is closed to new replies.