Skip to main content
seofields
docs

Product

Add Product structured data to your Sanity-powered site. Enable rich results with pricing, availability, and ratings in Google Shopping and search.

About Product

Product schema enables rich results with pricing, availability, and ratings in Google Shopping and search. Marking up your products with structured data helps them stand out in search results and can improve click-through rates for e-commerce pages.

Fields

FieldTypeRequiredDescription
namestringThe name of the product.
imagestring | objectProduct image — a URL string or a full ImageObject with url, width, and height.
descriptionstringA description of the product.
brand.namestringThe name of the product's brand.
skustringStock Keeping Unit — a unique identifier for the product.
gtinstringGlobal Trade Item Number (covers GTIN-8, GTIN-13, GTIN-14).
mpnstringManufacturer Part Number.
offers.pricestringThe price of the product, e.g. "29.99".
offers.priceCurrencystringISO 4217 currency code, e.g. "USD".
offers.availabilitystringProduct availability status (e.g. InStock, OutOfStock, PreOrder).
offers.urlstringURL of the product offer page.
offers.itemConditionstringCondition of the product (e.g. NewCondition, UsedCondition, RefurbishedCondition).
aggregateRating.ratingValuestringThe average rating, e.g. "4.5".
aggregateRating.reviewCountstringTotal number of reviews.
aggregateRating.bestRatingstringThe highest possible rating, e.g. "5".
review[].authorstringThe name of the reviewer.
review[].reviewRatingstringThe rating given in this review, e.g. "5".
review[].reviewBodystringThe full text of the review.

Plugin Registration

sanity.config.ts
import { defineConfig } from "sanity";
import { schemaOrgProductPlugin } from "sanity-plugin-seofields/schema";

export default defineConfig({
  // ... your project config
  plugins: [
    schemaOrgProductPlugin(),
  ],
});

Schema Usage

Add the schemaOrgProduct field to any document schema:

schemas/page.ts
import { defineField, defineType } from 'sanity'

export default defineType({
  name: 'page',
  title: 'Page',
  type: 'document',
  fields: [
    // ... your other fields
    defineField({
      name: 'schemaOrgProduct',
      title: 'Product Schema',
      type: 'schemaOrgProduct',
    }),
  ],
})

GROQ Query

GROQ query
*[_type == "yourDocument"][0]{
  schemaOrgProduct {
    name,
    image,
    description,
    brand {
      name
    },
    sku,
    gtin,
    mpn,
    offers {
      price,
      priceCurrency,
      availability,
      url,
      itemCondition
    },
    aggregateRating {
      ratingValue,
      reviewCount,
      bestRating
    },
    review[] {
      author,
      reviewRating,
      reviewBody
    }
  }
}

Next.js Component

app/layout.tsx
import { ProductSchema } from "sanity-plugin-seofields/schema/next";

export default function Layout({ children }: { children: React.ReactNode }) {
  // Fetch your product data from Sanity
  const product = await sanityClient.fetch(query);

  return (
    <html lang="en">
      <body>
        <ProductSchema data={product.product} />
        {children}
      </body>
    </html>
  );
}

JSON-LD Output

Generated JSON-LD
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Wireless Noise-Cancelling Headphones",
  "image": "https://example.com/headphones.jpg",
  "description": "Premium wireless headphones with active noise cancellation and 30-hour battery life.",
  "brand": {
    "@type": "Brand",
    "name": "SoundMax"
  },
  "sku": "WH-1000XM5",
  "gtin": "4549292196405",
  "mpn": "WH1000XM5/B",
  "offers": {
    "@type": "Offer",
    "price": "349.99",
    "priceCurrency": "USD",
    "availability": "https://schema.org/InStock",
    "url": "https://example.com/products/headphones",
    "itemCondition": "https://schema.org/NewCondition"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.8",
    "reviewCount": "2847",
    "bestRating": "5"
  },
  "review": [
    {
      "@type": "Review",
      "author": "John Smith",
      "reviewRating": "5",
      "reviewBody": "Best headphones I have ever used. The noise cancellation is incredible."
    }
  ]
}

Last updated: May 27, 2026. Tested with: Sanity Studio v3, v4, and v5.

Was this page helpful?