of reviews for a product */ _n( '(%s customer review)', '(%s customer reviews)', $reviews_count, 'woocommerce' ), esc_html( $reviews_count ) ); if ( $is_descendent_of_single_product_block ) { $customer_reviews_count = '' . $customer_reviews_count . ''; } elseif ( $is_descendent_of_single_product_template ) { $customer_reviews_count = '' . $customer_reviews_count . ''; } $reviews_count_html = sprintf( '%1$s', $customer_reviews_count ); $html = sprintf( '
%3$s
', esc_attr( $label ), wc_get_star_rating_html( $average_rating, $reviews_count ), $is_descendent_of_single_product_block || $is_descendent_of_single_product_template ? $reviews_count_html : '' ); } else { $html = ''; } return $html; }; add_filter( 'woocommerce_product_get_rating_html', $filter_rating_html, 10, 3 ); $rating_html = wc_get_rating_html( $product->get_average_rating() ); remove_filter( 'woocommerce_product_get_rating_html', $filter_rating_html, 10 ); $classes = implode( ' ', array_filter( array( 'wc-block-components-product-rating wc-block-grid__product-rating', esc_attr( $text_align_styles_and_classes['class'] ?? '' ), esc_attr( $styles_and_classes['classes'] ), ) ) ); $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes, 'style' => esc_attr( $styles_and_classes['styles'] ?? '' ), ) ); return sprintf( '
%2$s
', $wrapper_attributes, $rating_html ); } return ''; } }