In the shop page product display ratings if the product has rating

This topic has 8 replies, 3 voices, and was last updated 5 years, 10 months ago ago by Olga Barlow

  • Avatar: Mohammed
    Mohammed
    Participant
    January 15, 2019 at 06:42

    My suggestion and issue was i want to display rating option if the product does not any rating and reviews like all stars in grey color in order to give rating.

    Currently there is no rating option displaying in the shop page if product doesn’t have any ratings.

    7 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 15, 2019 at 17:53

    Hello,

    Add the following code in child theme functions.php

    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
    add_action('et_after_shop_loop_title', 'get_star_rating' );
    function get_star_rating()
    {
        global $woocommerce, $product;
        $average = $product->get_average_rating();
    
        echo '<div class="star-rating"><span style="width:'.( ( $average / 5 ) * 100 ) . '%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'woocommerce' ).'</span></div>';
    }

    Regards

    Avatar: Mohammed
    Mohammed
    Participant
    January 17, 2019 at 07:36

    Hello Olga,
    I have updated the code but it is not reflecting on the site

    It’s not showing rating

    THANKS AND REGARDS
    MOHAMMED

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 17, 2019 at 08:08

    Hello,

    Is the child theme activated on your site? Have you cleared all cache?
    Please provide temporary wp-admin and FTP access.

    Regards

    Avatar: Mohammed
    Mohammed
    Participant
    February 9, 2019 at 11:44

    I have done all possible things like clear cache, child theme etc,

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    February 10, 2019 at 09:56

    Hello,

    Provide FTP and Dashboard access to your site. We can’t tell you why this doesn’t work for you without checking the files.

    Regards

    Avatar: Mohammed
    Mohammed
    Participant
    February 16, 2019 at 11:36

    See in private content area

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    February 16, 2019 at 13:32

    Hello,

    1. Where have you added mentioned code in your child theme? Because functions.php file was the default. Once I added the code I see the rating on the shop page http://prntscr.com/mlvqmt So, don’t understand your issue.
    2. You have a problem with the PHP Memory limit http://prntscr.com/mlvofv because what to show all the products http://prntscr.com/mlvrll I would suggest you to choose the grid view and load more button and use the limit 50 products for example, don’t try to show all at once.

    Regards

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

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

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