• Resolved cselin

    (@cselin)


    I am trying to set up a theme where the user can page through single product listings using ajax. When on a single product page, when the user clicks ‘next product’ the user stays on the same page, and the new content is loaded into a central div with ajax.

    This is all working fine with the new product loading, add to cart working, etc, except for the product reviews.

    The ‘Reviews’ tab is completely empty when I load the product content with Ajax. (The tabs aren’t initialised either, but I added some js to initialise them).

    Is there a hook or some javascript that I need to use to make this content load? I’ve been searching through the docs but having a hard time finding a resolution.

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

    (@cselin)

    Solved – for anyone that has this same issue, I discovered that woocommerce doesn’t use any custom functionality to display reviews, it just uses the wp function comments_template() – which is a function that doens’t work unless in a single post or page template. So in order for it to fire in a custom ajax situation, it needs this before:

    <?php
    global $withcomments;
    $withcomments = true;
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Loading Single Product with Ajax – no reviews’ is closed to new replies.