Upgrade your Rich Snippets to the latest version

If you installed Judge.me before March 2017, you may still be using the old rich snippets. If that is the case, you will see the notice: "You are using an old Rich Snippets version: data-vocabulary". Click the Upgrade button to upgrade your rich snippets to the latest version: schema.org/AggregateRating.


Link all your Product snippets via @id (optional)

Normally, Judge.me's Product snippets are not linked to your theme's Product snippets by default. To maximize the chances Google understands all Product snippets belong together, we recommend you link these Product snippets together.


To do this, your theme needs to have JSON-LD snippets in the product.liquid template, and that JSON-LD snippet does not contain an @id already (check with your theme developer if you are not sure).

Then, please add this @id line to your theme's JSON-LD Product snippets:

"@id": {{ canonical_url | append: '#product' | json }},

You are most likely to find these JSON-LD snippets added as a script in your product.liquid template. Here is an example of a complete script tag that would cover your theme's JSON-LD Product snippets, with the @id line added below @type:

{% capture jsonld_brand_url %}https://{{ shop.domain }}{{ product.vendor | url_for_vendor }}{% endcapture %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",

  "@id": {{ canonical_url | append: '#product' | json }},

  "brand": {
    "@type": "Brand",
    "name": {{ product.vendor | json }},
    "url": {{ jsonld_brand_url | json }}
  },
  "sku": {{ product.selected_or_first_available_variant.sku | json }},
  "description": {{ product.description | strip_html | json }},
  "url": {{ canonical_url | json }},
  "name": {{ product.title | json }},
  {% if product.featured_image %}
  "image": "https:{{ product.featured_image | product_img_url: 'grande' }}",
  {% endif %}
  "offers": [{% for variant in product.variants %}{
    "@type": "Offer",
    "price": "{{ variant.price | divided_by: 100.0 }}",
    "priceCurrency": "{{ shop.currency }}",{% unless shop.metafields.jsonld.itemCondition == blank %}
    "itemCondition": "http://schema.org/{{ shop.metafields.jsonld.itemCondition }}",{% endunless %}
    "availability": "{% if variant.available %}InStock{% else %}OutOfStock{% endif %}"
  }{% unless forloop.last %},{% endunless %}{% endfor %}]
}
</script>


After you update your snippets, it's a good idea to let Google re-crawl your product pages. More information on how to ask Google for a re-crawl can be found here.

Here is the result you will achieve. As you can see in the screenshot below, the two Product snippets (Judge.me's + your theme's Product snippets) are integrated into 1 Product / Product snippet, because they share the same @id with as value the product URL.


Using Microdata Snippets

If your store does not use JSON-LD snippets then that is completely fine. We also push Microdata snippets, which comes in almost every theme, except a few very old themes which still use data-vocabulary.


Compared to JSON-LD snippets, linking our AggregateRating to the already existing Microdata product snippets has to be done by placing the widget inside the div containing itemscope itemtype="http://schema.org/Product".

If the position you place the widget is out of that div then the AggregateRating will not be linked to the Products rich snippets and thus most likely will be ignored by Google.


To find out if the widget is correctly placed inside the itemscope, all you'll have to do is inspect our widget, find the div with the product itemscope hover over it, then the highlighted section must include our widget as well. Like in the following image:

Disabling JSON-LD snippets

This is not recommended, but if you only want the microdata (HTML) snippets you can disable the Judge.me JSON-LD (Javascript) snippets by putting the following code at the bottom of your product.liquid file:

<script>  judgemeOpts=window.judgemeOpts||{};judgemeOpts.jldDisable=true </script>

Disabling microdata snippets

Microdata standard does not allow for multiple markup in the same Product rich snippet. So if for any reason you want to display two or more review widgets on the same page only one of them should have microdata aggregateRating snippet. To disable microdata snippet please use the following

{% capture review_widget %}  {% include 'judgeme_widgets', widget_type: 'judgeme_review_widget', concierge_install: true %} {% endcapture %}      {{ review_widget | replace: "itemprop", 'duplicated-itemprop' | replace: "itemscope", 'duplicated-itemscope' }}


Remove Duplicated AggregateRating in Woocommerce

Sometimes the markup generated by Woocommerce can cause a duplicated AggregateRating on the product pages. Here's a fix of it, a contribution of Fluidcart.io


Option 1, adding the code in functions.php:

/**
 * Remove WooCommerce Product Schema markup for `aggregateRating`.
 */
function prefix_remove_woocommerce_aggregate_rating_markup( $markup, $product ) {
  unset( $markup['aggregateRating'] );
  return $markup;
}
// IMPORTANT: Should run before YoastSEO WooCommerce filter with priority = 10
add_filter( 'woocommerce_structured_data_product', 'prefix_remove_woocommerce_aggregate_rating_markup', 5, 2 );


Option 2, installing and using the plugin (download here):

<?php
/*
Plugin Name: WooCommerce Schema Fix
Plugin URI: 
Description: Fix conflict between WooCommerce and Judge.me product schema data for `aggregateRating`.
Text Domain: wpseo-woocommerce-gutenberg-fix
Version: 1.0.0
Author: fluidcart.io
Author URI: https://fluidcart.io/
License: GPLv2

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

*/

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) { 
    exit;
}



/**
 * Plugin Main Class.
 */
class WooCommerceSchemaFix {

    // A single instance of this class.
    public static $instances   = array();
    public static $this_plugin = null;



    /**
     * Singleton instance function.
     *
     * @access public
     * @static
     * @return void
     */
    public static function instance() {
        $calledClass = get_called_class();

        if ( self::$instances[ $calledClass ] === null ){
            self::$instances[ $calledClass ] = new $calledClass();
        }

        return self::$instances[ $calledClass ];
    }



    /**
     * __construct function.
     * @access public
     * @return void
     */
    public function __construct() {
        $this->hooks();
    }



    /**
   * Initialize hooks.
   */
    public function hooks() {
        // IMPORTANT: Should run before YoastSEO WooCommerce filter with priority = 10
        add_filter( 'woocommerce_structured_data_product', array( $this, 'remove_woocommerce_aggregate_rating_markup' ), 5, 2 );
    }



    /**
     * Remove WooCommerce Product Schema markup for `aggregateRating`.
     */
    public function remove_woocommerce_aggregate_rating_markup( $markup, $product ) {
        unset( $markup['aggregateRating'] );
        return $markup;
    }


}

WooCommerceSchemaFix::instance();


Tips or remarks?

If you followed a different approach than we offer to get your review snippets indexed by Google, please email us at support@judge.me so we can discuss it.