How can I add Schema Aggregate Rating values?

There are several ways to add aggregate rating markup to your content, but first, let’s talk about what an “aggregate rating” actually is. ;-) The website defines the Schema aggregateRating property value as:

The overall rating, based on a collection of reviews or ratings, of the item.

Two things to keep in mind about this:

  1. An aggregate rating value is calculated from several customer ratings / reviews for the current webpage content (e-commerce product reviews, for example).
  2. Google prefers — and often double-checks — that Schema markup reflects the current content of the webpage. So, if you want to manually set aggregate rating and/or review values in your Schema markup, make sure these customer ratings and/or reviews also appear in your webpage content (ie. the ratings and reviews are visible).

So what’s the best and easiest way?

  1. The very best (and easiest) way is to use a supported plugin that offers rating and review features, like the WPSSO Ratings and Reviews add-on. The WPSSO RAR add-on extends the WordPress comment system with optional rating and review features, and does not conflict with WooCommerce’s own product rating features. ;-)

    Note that if you’re using the WPSSO Core Pro plugin, ratings and reviews from WooCommerce, Yotpo Social Reviews for WooCommerce, and WP-PostRatings are also supported.

  2. Alternatively, if you’re using a non-supported plugin — that saves aggregate rating values in post meta — you can use a WPSSO Core custom filter to add the Schema aggregateRating markup.

    Note that if you’re using the WPSSO JSON Pro add-on, you can also hook the Schema aggregateRating property directly. Either filter will work fine — it just depends on your personal preference. ;-)

  3. If none of the above solutions work for you, the WPSSO Schema JSON-LD Markup add-on also offers a [schema] shortcode that you can use to customize the current webpage Schema properties. The schema shortcode documentation includes a practical example on how to add custom aggregate rating values to your content.