Book Image

WooCommerce Cookbook

By : Patrick Rauland
Book Image

WooCommerce Cookbook

By: Patrick Rauland

Overview of this book

Table of Contents (17 chapters)
WooCommerce Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Displaying positive reviews in the product description


If you do have brand evangelists praising your products, you should make sure their reviews are visible. If you have products that are hard to justify, some social affirmation that other people enjoy the product will be a huge benefit. If that's the case, you might want to highlight a product review in the product description to make sure every user sees it.

Getting ready

You need to have a product with at least one review in your store.

How to do it...

There aren't any plugins that do this. We'll have to custom-code this by ourselves. Unlike many of the code snippets I've shared, this one is a bit lengthier and is broken up into several pieces. Let's take a look at the following steps:

  1. Open up your theme's functions.php file or a custom WooCommerce plugin.

  2. The first step is to tell WordPress to run a custom function at a specific point on the product page. At the bottom of the file, add the following code:

    add_action( 'woocommerce_single_product_summary...