• Resolved benjaminblue

    (@benjaminblue)


    Hello,

    I currently using this code in my functions.php file to add reviews on single product pages:

    add_action('woocommerce_single_product_summary', 'show_reviews_bar', 70);
    function show_reviews_bar() {
        
        // shortcode from Customer Reviews settings
        echo do_shortcode("[cusrev_all_reviews sort='DESC' per_page='5' number='-1' show_summary_bar='true' show_pictures='false' show_products='true' categories='' products='' shop_reviews='false' number_shop_reviews='-1' inactive_products='false' show_replies='false']");
    }
    

    It is working but I need to only show the reviews for the product I am looking at.

    This part of the shortcode needs to be the variable for the current product: products=''

    Has anyone done this or know the variable i am looking for?

Viewing 1 replies (of 1 total)
  • Thread Starter benjaminblue

    (@benjaminblue)

    I found it and if anyone else needs it, it is:

    global $product;
        $id = $product->get_id();
    

    so

    products='$id'

    • This reply was modified 4 years, 4 months ago by benjaminblue.
Viewing 1 replies (of 1 total)
  • The topic ‘Show reviews on single product page only for that product’ is closed to new replies.