productbigcommercereview

Display product reviews in structured data in Big Commerce


I'm looking to display product reviews on product pages in the structured data (head) in Big Commerce. So I am currently doing this via the 'Script Manager'. Here's a little sample of how that looks:

<script type="application/ld+json">
   {{#if page_type "==" "default"}}
      ...
   {{else if page_type "==" "product"}}
      {
         "@context": "https://schema.org",
         "@graph": [
            {
               "@type": "WebPage"{{#if product.num_reviews ">" 0}},
               "review": [
                  {
                     "@type": "Review",
                     "rating": {{product.rating}}
                  }
               ]
               {{/if}}
            },
            ..
         ]
      }
   {{/if}}
</script>   

The documentation doesn't say anything about any ways to get details about reviews other than the two values: product.num_reviews & product.rating (which appears to be an aggregate of all ratings). Is there any way to get individual reviews?


Solution

  • There is a reviews property in the product object. Strange, it is not documented.

    You could output it into the console to see what it looks like.

    BigCommerce reviews in Stencil