
JSON-LD is a set of structured data, based on JSON, that provides an easy to read and write format for linked data. Support for the JSON-LD structured data has risen over the last several years with many search engines accepting equivalent formatting for previous Schema microdata. Since the formatting does not rely on nested HTML markup, it is often easier to implement on complex e-commerce sites.
In this article, I will cover examples of structured data for simple products as well as products that have multiple prices. To validate the data, or validate any customization that you may make, Google provides a structured data testing tool.
The structured data for a product must refer to the schema context for a product, which is defined here. This tells the consumer of the data what properties to expect.
{
"@context": "https://schema.org/",
"@type": "Product"
}
After this initial step, you can then start to define the appropriate properties for the product. At a minimum, the structured data should include the name, image, price and availability of the product. Name and image are easily defined as text properties.
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Factory Widget",
"image": "http://www.example.com/widget.jpg"
}
To define the price and availability of a product you must define an offer (https://schema.org/Offer). You can think of the offer property as a sub-structure or object that is attached to the product structure. In this context, the offer must supply the price, currency, and availability. The availability of a product should reference the schema defined values for stock keeping statuses. Some examples of those statues are in stock, out of stock, and pre-order. The currency of the product should be provided as the 3-letter standard abbreviation (ISO 4217). For many search engines, including Google, the price of a product should not be provided with the currency character.
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Factory Widget",
"image": "http://www.example.com/widget.jpg",
"offers": {
"@type": "Offer",
"priceCurrency": "USD",
"price": "119.99",
"availability": "https://schema.org/InStock"
}
}
The example above fulfills the basic requirements of most structured data implementations, though there are many other properties that you can define within a product. Some of these properties will be supported by specific search engines, others will not. Google maintains a list of some of the supported properties here that they use for rich snippets and other offerings.
For a product that may have many offers, for instance where the price will vary with product options, you may further expand the offer property. There are several ways to do this but most common is to provide a list of offers or aggregate offers.
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Factory Widget",
"image": "http://www.example.com/widget.jpg",
"offers": [
{
"@type": "Offer",
"priceCurrency": "USD",
"price": "119.99",
"availability": "https://schema.org/InStock"
},
{
"@type": "Offer",
"priceCurrency": "USD",
"price": "159.99",
"availability": "https://schema.org/InStock"
}
]
}
Need help with structured data product schema for your ecommerce site? Drop us a line.