Halloween Sale 15% off Ends in See the plans
Universal

Review Prompt Below the Product Summary

Adds a "Bought this? Share your review" link with the current review count under the WooCommerce product summary, opening the Reviews tab.

Don’t have WPIDE yet? Install it on your site

Code

<?php
global $product;
if ( $product instanceof WC_Product && $product->get_reviews_allowed() && 'yes' === get_option( 'woocommerce_enable_reviews' ) ) :
    $wpide_reviews = (int) $product->get_review_count();
    ?>
<p class="wpide-review-prompt" style="clear:both;margin:1em 0">
    <a href="#reviews" class="woocommerce-review-link">
        <?php echo esc_html( $wpide_reviews ? sprintf( 'Bought this? Add your review to the %d others', $wpide_reviews ) : 'Bought this? Be the first to write a review' ); ?>
    </a>
</p>
<?php endif; ?>

Notes

The woocommerce-review-link class makes WooCommerce open the Reviews tab on click.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.