Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1153728

    Hello,
    I created custom page for each product and when someone review the product i cannot see the stars near the Name of the product itself on the page. As on this page
    Here right under the product name i can see the 5 stars and the “1 client review” link that bring me down in the page to the review section.

    If on a custom made page i add the review block i can see the review but i don’t know how to recall the stars near the product name.
    Any hint?
    I tried to check on woocommerce shortcode and found nothing about it.

    Plus i’d like to be able to put the review under a tab but i don’t know how to call the shortcode for the review block
    https://www.staging2.morsoworld.com/shop/collari/collare-routine/#tab-id-2

    Thank you

    #1153988

    Hi,

    1- I tried adding following code to bottom of Functions.php file of your child theme however i am getting “Scrape nonce check failed. Please try again.” error. Please try adding the code to file via FTP

    // Get star rating of product
    function get_star_rating() {
        global $woocommerce, $product;  
        $average      = $product->get_average_rating();
        $review_count = $product->get_review_count();
    
        return '<div class="star-rating">
                    <span style="width:'.( ( $average / 5 ) * 100 ) . '%" title="'. 
                      $average.'">
                        <strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__( 'out of 5', 'woocommerce' ).                              
                    '</span>                    
                </div>'.'
                <a href="#reviews" class="woocommerce-review-link" rel="nofollow">( ' . $review_count .' )</a>';
    
    }
    function custom_shortcode() {
    	return get_star_rating();
    }
    add_shortcode( 'get_average_rating', 'custom_shortcode' );

    Then use following shortcode to display star rating of single product
    [get_average_rating]

    2- I added following shortcode to your tab to display reviews
    [av_product_review av_uid='']

    Cheers!
    Yigit

    #1154007

    Hello Yigit.
    Thank you for the review solution.
    is it possible to have the stars and the number of review near and centered under the title?
    At the moment the review number is on the left and the stars are on the right side.
    Thank you.

    #1154022

    Hi,

    Please try adding this code to the Quick CSS section under Enfold > General Styling or to your child theme’s style.css file:

    CSS Snippet:

    
    .morso_blocco_acquisto .avia_textblock .star-rating {
        float: none;
        display: inline-block;
    }
    .morso_blocco_acquisto .avia_textblock {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    
    

    Best regards,
    Yigit

    #1154084

    Thank you Yigit it works perfectly.
    Top :)

    #1154107

    Hi,

    You are welcome! :)

    For your information, you can take a look at Enfold documentation here – https://kriesi.at/documentation/enfold/
    If you have any other questions or issues, feel free to start a new thread under Enfold sub forum and we will gladly try to help you :)

    Best regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Display star review under title for custom product page with page builder’ is closed to new replies.