• Resolved thehypetype

    (@thehypetype)


    My website keeps telling me I have 15 reviews for every product – even ones with no reviews.

    I was trying to follow a tutorial on moving the star rating and accidentally did this.

    Think this is what done it

    foreach ($products as $key => $value) {
    update_post_meta( $value, ‘_wc_average_rating’, 1 );
    update_post_meta( $value, ‘_wc_review_count’, 15 );
    // update_post_meta( $value, ‘_wc_rating_count’, $re );

    is there anywhere i can reset them back to what they should be?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @thehypetype!

    It doesn’t look like that code is meant to move the star rating. If you don’t want all your products to show the same review count, then you’ll need to remove this code from your site and replace it with something along these lines:

    add_action( 'woocommerce_single_product_summary', 'change_stars_rating_location', 4 );
    function change_stars_rating_location() {
        global $product;
    
        remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
        add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 35 );
    }

    You can then change the priority from 35 to something else.

    Cheers!

    Thread Starter thehypetype

    (@thehypetype)

    Thanks Rynald0s all is good now ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Review Count False Reading’ is closed to new replies.