Make product pages readable by AI shopping agents: price, stock, variants in JSON-LD
Short answer: put one Product with an Offer in server-rendered JSON-LD on every product page. Give the price as a plain number plus an ISO currency code, use a schema.org availability value for stock, and describe varian
Short answer: put one Product with an Offer in server-rendered JSON-LD on every product page. Give the price as a plain number plus an ISO currency code, use a schema.org availability value for stock, and describe variants with ProductGroup. Then generate it from the same data as the visible page so the two can never disagree.
Disclosure: I'm on the team behind Axidort, which scans sites with an AI agent and builds agent-ready sites. The steps below need nothing from us. There is a free check and a link for businesses at the end.
An agent that opens a product page has to work out which number is the price. A page can show a list price, a sale price, a per-pack price and a financing teaser. JSON-LD removes the guessing. Axidort's structured data guide makes the same point: the data must match what the page shows, or an agent may quote the wrong figure.
1. The minimum that works
Start with this on a single product page. Property names come from schema.org/Product and schema.org/Offer; Google's product structured data docs list what Google reads.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Nitrile gloves, box of 100",
"description": "Powder-free nitrile gloves, size M, 100 per box.",
"sku": "NG-100-M",
"brand": { "@type": "Brand", "name": "ExampleCo" },
"offers": {
"@type": "Offer",
"url": "https://www.example.com/p/nitrile-gloves-m",
"price": "12.40",
"priceCurrency": "GBP",
"priceValidUntil": "2026-12-31",
"availability": "https://schema.org/InStock",
"itemCondition": "https://schema.org/NewCondition"
}
}
</script>
Rules that prevent most mistakes:
-
priceis a number as a string, with a dot and no currency symbol or thousands separator. Not"£12.40"and not"1,240.00". -
priceCurrencyis an ISO 4217 code such as GBP, USD or EUR. -
availabilityuses a schema.org value:InStock,OutOfStock,BackOrder,PreOrder, and so on. Free text such as "only 3 left" does not belong here. - Put a unit in the name or description ("box of 100"). The Axidort guide recommends this so per-box and per-item prices are not compared by mistake.
- Identifiers (
sku,mpn,gtin) help an agent match your product to the same product elsewhere. The guide calls them the strongest match signal. - Do not add ratings or reviews that are not shown on the page.
2. Render it on the server
If your JSON-LD is injected by a tag manager after the page loads, any agent or crawler that does not run scripts never sees it. Check your own page with a plain request, which does not execute JavaScript:
curl -s https://www.example.com/p/nitrile-gloves-m | grep -c 'application/ld+json'
0 means the markup is not in the HTML your server sends. Move it into the template, or into your framework's server rendering, rather than a client-side script.
3. Variants: one group, many offers
Sizes and colours are where agents most often pick the wrong price. schema.org has ProductGroup for this, with each variant as its own Product that carries its own sku, offers and stock. Check Google's variants documentation for the current required properties before you ship.
{
"@context": "https://schema.org",
"@type": "ProductGroup",
"name": "Nitrile gloves",
"productGroupID": "NG-100",
"variesBy": ["https://schema.org/size"],
"hasVariant": [
{
"@type": "Product",
"name": "Nitrile gloves, size M, box of 100",
"sku": "NG-100-M",
"size": "M",
"offers": {
"@type": "Offer",
"price": "12.40",
"priceCurrency": "GBP",
"availability": "https://schema.org/InStock"
}
},
{
"@type": "Product",
"name": "Nitrile gloves, size L, box of 100",
"sku": "NG-100-L",
"size": "L",
"offers": {
"@type": "Offer",
"price": "12.40",
"priceCurrency": "GBP",
"availability": "https://schema.org/OutOfStock"
}
}
]
}
The point is that size L being out of stock must not make size M look unavailable, and the reverse.
4. B2B: quantities and tiers
For suppliers, the Axidort guide suggests eligibleQuantity on the offer, with the unit price and a minimum, so an agent sees "from 1 box" rather than guessing. Where you have volume tiers, a list of Offer entries, each with its own eligibleQuantity, is one way to express them. Contract prices behind a login cannot go in public markup, and that is fine: markup should only describe what a logged-out visitor sees.
5. Test it in four steps
-
Is it in the HTML? Run the
curlcheck above on a product URL. - Is it valid? Paste the URL into Google's Rich Results Test or the Schema Markup Validator.
- Does it match the page? This is the step people skip. The script below prints what the markup says so you can compare it with what the page shows.
- Is it right after a change? Re-run it after a price change or a stock-out. Stale availability is a common failure when markup is hand-maintained.
import json, re, sys, urllib.request
url = sys.argv[1]
req = urllib.request.Request(url, headers={"User-Agent": "jsonld-check/0.1"})
html = urllib.request.urlopen(req, timeout=20).read().decode("utf-8", "replace")
blocks = re.findall(
r'<script[^>]+application/ld\+json[^>]*>(.*?)</script>', html, re.S
)
if not blocks:
sys.exit("No JSON-LD in the server-rendered HTML")
def walk(node):
if isinstance(node, list):
for n in node:
yield from walk(n)
elif isinstance(node, dict):
yield node
for v in node.values():
yield from walk(v)
for raw in blocks:
for node in walk(json.loads(raw)):
offers = node.get("offers")
if node.get("@type") == "Product" and offers:
for o in offers if isinstance(offers, list) else [offers]:
price = str(o.get("price"))
print(node.get("sku"), price, o.get("priceCurrency"),
o.get("availability"),
"| price text on page:", price in html)
The last column only shows that the number appears somewhere in the HTML, so treat it as a prompt to look, not a pass. Open the page and confirm that the markup's price is the one a shopper pays.
Common mistakes
- A currency symbol or formatted number in
price. - JSON-LD price that is the list price while the page shows the sale price.
- Availability copied once and never updated.
- Markup for a variant the page does not offer.
- Markup that only exists after JavaScript runs.
- A bot challenge or firewall in front of the page. The best markup does nothing if the agent never gets the HTML. I covered that separately in Is your site blocking AI agents?.
One honest limit: structured data makes a product readable and comparable. It does not make an agent choose you. That still depends on price, availability, reputation and whether the agent can reach the page.
FAQ
Do I need JSON-LD if my page has clear visible text?
Visible text helps, and you should keep prices in real text rather than images. JSON-LD is a second, unambiguous copy that tools can parse without interpreting layout.
Should I use JSON-LD, Microdata or RDFa?
Google's documentation recommends JSON-LD, and it is the easiest to generate from a template.
Does it replace a product feed?
No. Generate markup and feeds from one source so they cannot disagree.
What if prices depend on the customer?
Mark up only the public price. Customer-specific prices belong behind your login and in an API, not in public markup.
A free check, if you want one
If you would like to see what an agent actually does on your pages, the free Axidort Score sends a declared browser agent (AxidortAgentCheck) through search, product, price and stock, and shows where it stopped, in about three minutes. It never orders, pays or logs in. A score is an automated opinion from one scan at one moment, not a verdict on your site. For context, the Axidort Index scanned 50 commerce sites on 1 October 2026 and found a median of 11 out of 100, with the same caveat.
If you run a business and want this built for your catalogue, you can talk to our team. Students and hobbyists: the free guides cover all of this without any sign-up.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.