Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Comments

Discussion in 'Misc WordPress Requests' started by Rushabh Shah, Dec 7, 2017.

  1. Rushabh Shah


    Reply To: Comments, by Rushabh Shah

    Hi aleksandarstefanov,

    Nothing is impossible.

    Whenever you want to review of the product you can display on any page just need to hook and filter of proper place. Here I have see you one example. If you want display review on shop page just put below code in your active theme’s functions.php file.

    add_action('woocommerce_after_shop_loop_item', 'add_star_rating' );
    function add_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>';

    Rushabh Shah

    Reply To: Comments

Share This Page

Web Hosting