• Resolved rifatspir

    (@rifatspir)


    I just added this code in child function php and it working to remove zero number from reviews but it shows error when the review is not enable in any product. How do I fix that? this error only shows when the enable review checkbox is unchecked

    Error screenshot

    View post on imgur.com

    // 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;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Removing the (0) from the product reviews tab menu item in Woocommerce’ is closed to new replies.