Search code examples
schema.orgrich-snippetsjson-ld

How to enable rich snippets using JSON-LD code for multi product pages?


I would like to make rich snippets for product pages appear in google SERPS. It's for a page that:

  • Contains multiple products that each have individual prices
  • Has an average aggregate rating

As far as I understand it's possible to add multiple products to one page in schema org using multiple offers. The problem is that I couldn't find the documentation on how to do that using JSON-LD. I've tried it myself in the code below but have no idea if this is correct. Can I just add offers like this or do I need to add them in a different way?

<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"aggregateRating": {
    "@type": "AggregateRating", 
    "ratingValue": "[rating variable]",
    "reviewCount": "[count variable]"
},
"name": "[product name]",
"offers": {
    "@type": "Offer", 
    "price": "[price of product]",
    "priceCurrency": "[currency]"
},
"name": "[product name]",
"offers": {
    "@type": "Offer", 
    "price": "[price of product]",
    "priceCurrency": "[currency]"
},
"name": "[product name]",
"offers": {
    "@type": "Offer", 
    "price": "[price of product]",
    "priceCurrency": "[currency]"
},
}
</script>

Solution

  • just create an array of the offers.

    <script type="application/ld+json">
    {
      "@context": "http://schema.org/",
      "@type": "Product",
      "name": "[name]",
      "image": "[logo]",
      "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "[rating],
        "reviewCount": "[votes]"
      },
      "offers": [{
        "@type": "Offer",
        "priceCurrency": "[currency]",
        "price": "[price]",
        "category": {
          "@type": "thing",
          "name": "[name product]"
        }
      },{
        "@type": "Offer",
        "priceCurrency": "[currency]",
        "price": "[price]",
        "category": {
          "@type": "thing",
          "name": "[name product]"
        }
      },{
        "@type": "Offer",
        "priceCurrency": "[currency]",
        "price": "[price]",
        "Category": {
          "@type": "thing",
          "name": "[name product]"
        }
      }]
    }
    </script>