Aggregate review

 

Before you begin, please note these 2 things:

  1.  Add the schema code on a specific product page: Google doesn’t support star ratings on root domains/homepages. According to their guidelines in order for the stars to show in the search results the schema code needs to be placed in a web page showcasing a specific product or the service you are offering. So, please add the schema code on a specific product or service page and not the homepage.
  2. Add the code in the html header, not the body.
  3. Add the code before other schema codes: Make sure the schema code is added at the top of your page code. This means that it needs to be before any other schema codes in the header of your page. If you use WordPress, please use a plugin such as Header and Footer Scripts to add the code in the header for a specific page.
  4. Make sure your code include below parts:
    • Type: can be:
      product,
      Book
      Course
      CreativeWorkSeason
      CreativeWorkSeries
      Episode
      Event
      Game
      HowTo
      LocalBusiness
      MediaObject
      Movie
      MusicPlaylist
      MusicRecording
      Organization
      Product
      Recipe
      SoftwareApplication
    • name: The name of the reviewed target, such as “Laptop Dell Xps 15”
    • Count: At least one of ratingCount or reviewCount is required
    • ratingValue (out of 5):

https://developers.google.com/search/docs/data-types/review-snippet

One example will be:

<script type="application/ld+json">
    {
        "@context": "https://schema.org/",
        "@type": "Product",
        "name": "VoIP Service",
        "identifier": "0001",
        "image": "http://frankfu.click/wp-content/uploads/2019/04/Logo_with_name_400x198.png",
        "description": "High Quality VoIP service with excellent knowledge of networking and Security, make sure your telephony always online, safe and sound!",
        "brand": "MCI",
        "sku": "0001",
        "gtin8": "0001",
        "offers": {
            "@type": "Offer",
            "url": "http://frankfu.click/voip",
            "priceCurrency": "AUD",
            "price": "1000",
            "priceValidUntil": "2026-11-01",
            "availability": "https://schema.org/InStock",
            "itemCondition": "https://schema.org/NewCondition"
        },
        "aggregateRating": {
                "@type": "AggregateRating",
                "name": "VoIP Service",
                "ratingValue": "5",
                "bestRating": "5",
                "worstRating": "5",
                "ratingCount": "4"
            },
        "review": {
            "@type": "Review",
            "name": "Worth a go",
            "reviewBody": "frankfu.click did an analog phone to IP telephony migration service for us, he always suggest the open source software, which is cheap, safe and mature. there was almost no down time for us and our staff are happy with the new freePBX system.",
            "reviewRating": {
                "@type": "Rating",
                "ratingValue": "5",
                "bestRating": "5",
                "worstRating": "5"
            },
            "datePublished": "2019-10-31",
            "author": {
                "@type": "Person",
                "name": "Bella Cui"
            },
            "publisher": {
                "@type": "Organization",
                "name": "Google"
            }
        }
    }
</script>
Test your structured data

You can generate with a online tool:

https://technicalseo.com/tools/schema-markup-generator/

https://search.google.com/structured-data/testing-tool

https://search.google.com/test/rich-results

 

Remove the structured data from woocommerce

 

Woocommerce shipped with the structured data, if you want to remove it to avoid conflict with your script, add below to funtions.php to remove it.

//Remove the Woocommerce structed data
/** * Remove Product's Structured Data - Price, stock, rating. */ 
function remove_partial_product_structured_data( $markup_offer, $product ) { $markup_offer = array( 'availability' => 'https://schema.org/' . ( $product->is_in_stock() ? 'InStock' : 'OutOfStock' ),
'url' => get_permalink( $product->get_id() ),
'seller' => array(
'@type' => 'Organization',
'name' => get_bloginfo( 'name' ),
'url' => home_url(),
),
);

unset( $markup_offer['availability'] );

return $markup_offer;
unset( $markup['aggregateRating'] );

return $markup;
}
add_filter( 'woocommerce_structured_data_product', 'remove_partial_product_structured_data', 10, 2 );