There are several ways to add Schema aggregate rating markup, but before we discuss the “How”, let’s review what a Schema aggregate rating value actually is. ;-)
The Schema.org 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:
- That an aggregate rating value is calculated from several customer ratings / reviews for the current webpage content — WooCommerce product reviews, for example.
- 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 that these customer ratings and reviews also appear in your webpage content (ie. that these ratings and reviews are visible).
Two options to add Aggregate Rating markup:
- Use a single-purpose aggregate rating and/or review plugin, or copy-paste custom markup in your template(s). The downside to this option is that all your other content (images, videos, publisher, author, product details, etc.) is not included in this single-purpose / custom markup.
- Use a complete and full-featured meta tag and Schema plugin, like WPSSO Core and its WPSSO Schema JSON-LD Markup add-on. There are a lot of upsides to this, but one downside is that you may have to tell WPSSO (or any similar full-featured plugin) about any unknown / unsupported rating and review values provided by other plugins. Luckily, WPSSO Core and its WPSSO JSON add-on offer a few ways to do this. ;-)
So what’s the best and easiest way?
- The best (and easiest) way is to use a WPSSO Core 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. ;-)
- 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 Aggregate Rating markup.
Note that if you’re using the WPSSO JSON Premium add-on, you can also hook the Schema aggregateRating property directly. Either filter will work fine — it just depends on your personal preference. ;-)
- 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.