How to show review count in product archive page

This topic has 5 replies, 3 voices, and was last updated 6 months, 1 weeks ago ago by Andrew Mitchell

  • Avatar: vera
    Ve01
    Participant
    June 10, 2024 at 17:14

    Hi

    I add PHP code to show rating even the rating count is zero in product archive page by following the link https://www.8theme.com/topic/how-to-show-reviews-0-on-single-product-builder-product-page/

    There are the other two issues as below.
    1. How can I show the rating count (0,1,2..) next to the star rating in product archive page?
    2. In the single product page, How can I change the star rating(0 customer reviews) to star rating(0)?

    Please find the attachment.

    Thank you

    Files is visible for topic creator and
    support staff only.
    4 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    June 11, 2024 at 07:22

    Dear Vera,

    We hope this message finds you well.

    We are pleased to inform you that we have updated the custom codes as follows:

    
    add_filter('woocommerce_product_get_rating_html', function($html, $rating, $count) {
    	$label = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $rating );
    	$html  = '<div class="star-rating" role="img" aria-label="' . esc_attr( $label ) . '">' . wc_get_star_rating_html( $rating, $count ) . '</div><span class="rate-count">('.$count.')</span>';
    	return $html;
    }, 10, 3);
    

    Additionally, we have implemented the following custom CSS under XStore > Theme Options > Theme Custom CSS > Global CSS:

    
    .single-product a.woocommerce-review-link {
        display: none;
    }
    

    Could you please review these changes at your earliest convenience? Your feedback is very important to us.

    Best regards,
    8Theme’s Team

    Avatar: vera
    Ve01
    Participant
    June 12, 2024 at 20:49

    Hi

    Thanks for your confirmation.
    I updated the php code you shared with me.There are two issues.
    1. I found that the star rating mark(★) disappeared in product archive page and single product page and the star mark became as “Rated 0 out of 5”. I don’t need to change the star rating mark.
    2.The rating in the single product page can not display correct.

    Please find the details in attachment.

    Files is visible for topic creator and
    support staff only.
    Avatar: Justin
    Luca Rossi
    Support staff
    June 13, 2024 at 05:05

    Hi @vera,

    The forum has removed some HTML codes in our replies.

    We meant we’ve successfully implemented the codes into your website, so you don’t have to update the codes again.

    Now we’ve already corrected the codes. Could you please double check?

    https://prnt.sc/KWVfBjNVWlGF

    Thank you!

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    June 13, 2024 at 10:37

    Dear vera,

    Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?

    Click here to share your insights: https://themeforest.net/downloads

    Your support fuels our journey, and we appreciate it more than words can express.

    Best Regards,
    The 8Theme Team

  • Viewing 5 results - 1 through 5 (of 5 total)

The issue related to '‘How to show review count in product archive page’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.