Support » Plugin: WooCommerce » Help with php WooCommerce function

  • Hello,
    I have a woocommerce store and on the product pages, it says “Reviews (0)” or “Reviews (2)” for the reviews tab. I used this code successfully before php updated:

    // Remove zero reviews from menu item in product tabs
    add_filter( 'woocommerce_product_tabs', 'custom_product_review_tab', 10, 1 );
    function custom_product_review_tab( $tabs ) {
        if( is_admin() ) return;
    
        global $product;
    
        if ( $product->get_review_count() == 0 ) {
            $tabs['reviews']['title'] = __("Reviews", "woocommerce");
        }
    
        return $tabs;
    }

    Now when I use it, it doesn’t work how I want. I also decided I don’t want the (2) even when the number isn’t 0 so I changed get_review_count() == 0 to get_review_count() >= 0 but it still doesn’t work. Did something change with woocommerce or is the new php version? Somebody please help me. Thank you

  • You must be logged in to reply to this topic.