How to show Reviews (0) on Single Product Builder product page

This topic has 8 replies, 4 voices, and was last updated 2 years, 9 months ago ago by Olga Barlow

  • Avatar: amongthieves
    amongthieves
    Participant
    May 2, 2021 at 12:42

    Hi, i am trying to figure out how to show the product review “block” on the product page when using the Single Product Page builder. As it is right now (and by default for XStore theme), if a product has 0 reviews, the stars, text, link and review count are all hidden. I would like for this to not be the case. Is there a way, either by a small php snippet added to the functions file or with CSS if thats how its hidden, but i would like for that informaton to ALWAYS be visible, even when the product has zero reviews. I feel that even with 0 reviews it is important to have the ***** (0 customer reviews) part on the product page because this may alert the customer that there are product reviews and it may be a trigger for them to leave a review. Most customers are not going to scroll the entire product page (as ridiculous as that sounds, its the truth) so a good percentage of my customers may not even know there is product reviews unless they scroll down the product page. So having this information (rating and review link) inbetween the product title and product price will only help increase product reviews left on my store.

    Long story short, can you please help me with the code required to make the customer review link at the top of product pages appear regardless if there are any reviews or not.

    Thank you in advance for your help and thank you for making such an amazing theme and consistently updating it with amazing new features.

    **i included a screenshot to show you exactly what part of the single product page i am referring too **

    https://imgur.com/a/GcRpl3A

    7 Answers
    Avatar: Robert Hall
    Robert Hall
    Support staff
    May 2, 2021 at 18:46

    Hello

    Thank you so much for contacting us

    In our website Review is Displaying at the top of the page under the product title https://prnt.sc/12edbyh.

    Reviews is the built-in option of the WooCommerce plugin. You can enable it in the WooCommerce > Settings > Products http://prntscr.com/tpuzwo and also enable/disable for every single product http://prntscr.com/tpv0qo

    Product rating appears on the grid if it’s enabled in Theme Options > WooCommerce > Shop > Product Styles http://prntscr.com/tpv35n and on the single product page in the tabs area.

    Robert Hall

    Avatar: amongthieves
    amongthieves
    Participant
    May 3, 2021 at 04:27

    Wow… did you even READ my post? Seriously? There is absolutely no way you read my post, because if you did, there would be no way you would have replied with what you just did.

    Nowhere in my post did i say i needed help displaying ALL product reviews. Its like you read the title and just used a generic copy and paste reply. Unreal.

    What i need is help displaying that part of the product page WHEN THERE IS ZERO REVIEWS!!! As it is right now, the product reviews link is hidden if there are no reviews on the product. It only appears after the first review is left on the product. I want it to appear all the time, even when there are 0 reviews. So i want it to say (**** star rating) Customer Reviews (0).

    How can i make this question any clearer?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 5, 2021 at 14:45

    Hello,

    Take my apologies for the misunderstanding of our support member.
    To show 0 rating:
    1) Copy plugins/woocommerce/templates/single-product/rating.php
    to
    themes/your-child-theme-name/woocommerce/single-product/rating.php

    Find if ( $rating_count >= 0 ) : ?> and change to if ( $rating_count >= 0 ) : ?>

    2) Add the below code to child theme functions.php

    add_filter('woocommerce_product_get_rating_html', function($html, $rating, $count) {
    		if ( $count > 0) return $html;
    		$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>';
    		return $html;
    	}, 10, 3);

    Save changes.

    Regards

    Avatar: Daniel0002
    Daniel0002
    Participant
    February 10, 2022 at 22:05

    Hi Olga,

    does the code still work? I would use them too

    best regards
    Daniel

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    February 11, 2022 at 16:02

    Hello, @Daniel0002

    It should be ok. You may try that. Let me know if you have any problems with that.

    Regards

    Avatar: Daniel0002
    Daniel0002
    Participant
    February 11, 2022 at 18:20

    Hi Olga,

    I tried it and the code doesn’t work, can you please do something to make it work?

    best regards
    Daniel

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    February 11, 2022 at 18:32

    Hello,

    Create a separate topic, please, and provide WP Dashboard and FTP access to your site. We’ll check the problem.

    Regards

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

You must be logged in to reply to this topic.Log in/Sign up

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