Sub topic 6
Price, Sale Price, and Availability
This chapter assumes you can read the feed and JSON-LD examples from earlier chapters, know what a SKU and a variant are, and can run a short Python script. Price and availability are the fields shoppers act on first. They are also the fields that change most often and that shopping systems check hardest against your landing page.
Why these fields get extra scrutiny
An AI shopping answer may quote a price or say "in stock at Example Store." If that statement is wrong, the user is annoyed and the platform looks bad. Merchant systems therefore compare your feed against your product page and against structured data. A mismatch can get the item disapproved or demoted. A product with a perfect title and a stale price is a worse listing than a plainer title with a correct price.
Three feed attributes carry most of the load:
price: the regular price, with currency.sale_price: the current discounted price, optional.availability: whether the buyer can get the item now, later, or not at all.
The price attribute
A price is a number, then a space, then an ISO 4217 currency code.
<g:price>89.00 USD</g:price>Rules that cause most errors:
- Use a period as the decimal separator and no thousands separator.
1299.00 USDis valid.1.299,00 EURand$1,299are not. - Put the currency code after the number, with a space. A currency symbol is invalid.
- Do not put shipping into the price. Shipping has its own attributes, covered in the shipping and returns chapter.
- Do not submit
0as a placeholder for "call for price." Zero-priced items are generally rejected. - Match the page's tax treatment. In the US and Canada, the price excludes sales tax. In many other countries, such as EU member states, it must include VAT. Check the specification for each country you sell in.
The currency must match the target country of the listing. A feed for a US audience with prices in EUR will fail unless you have set up that currency deliberately.
Sale prices
sale_price holds the discounted price that is currently active. price stays as the regular price. Shopping surfaces can then show the original price crossed out beside the sale price.
<g:price>89.00 USD</g:price>
<g:sale_price>69.00 USD</g:sale_price>
<g:sale_price_effective_date>2026-11-27T00:00-0500/2026-11-30T23:59-0500</g:sale_price_effective_date>sale_price_effective_date is optional. It is an ISO 8601 start and end separated by a slash. When it is present, the sale price applies only inside that window. When it is absent, the sale price applies as soon as the feed is processed, until you remove it.
Constraints to respect:
sale_pricemust be lower thanprice, and in the same currency.- The page must show the sale price to a visitor when the window is active.
- Include the UTC offset in the dates. A date without an offset is ambiguous, and you may be off by a day for a site in another time zone.
- The window does not replace refreshing the feed. After the end date the system should fall back to
price, but the page and feed must agree at that moment, so schedule the page change and the feed change together.
The script below applies these rules. It parses prices exactly with Decimal, because floating-point numbers can turn 89.00 into 88.99999... and make comparisons unreliable. It reports problems and tells you which price should be live at a given time.
import re
from datetime import datetime, timezone
from decimal import Decimal
PRICE = re.compile(r"^(\d+(?:\.\d{1,2})?) ([A-Z]{3})$")
def parse_price(text):
match = PRICE.match(text.strip())
if not match:
return None
return Decimal(match.group(1)), match.group(2)
def parse_window(text):
start_text, end_text = text.split("/")
fmt = "%Y-%m-%dT%H:%M%z"
return datetime.strptime(start_text, fmt), datetime.strptime(end_text, fmt)
def effective_price(price, sale_price, window, now):
problems = []
base = parse_price(price)
if base is None:
return ["price is malformed"], None
effective = base
if sale_price:
sale = parse_price(sale_price)
if sale is None:
problems.append("sale_price is malformed")
elif sale[1] != base[1]:
problems.append("sale_price currency differs from price")
elif sale[0] >= base[0]:
problems.append("sale_price must be lower than price")
else:
active = True
if window:
try:
start, end = parse_window(window)
active = start <= now <= end
except ValueError:
problems.append("sale_price_effective_date is malformed")
active = False
if active:
effective = sale
return problems, effective
if __name__ == "__main__":
window = "2026-11-27T00:00-0500/2026-11-30T23:59-0500"
during = datetime(2026, 11, 29, 15, 35, tzinfo=timezone.utc)
after = datetime(2026, 12, 2, 12, 0, tzinfo=timezone.utc)
cases = [
("during sale", "89.00 USD", "69.00 USD", window, during),
("after sale", "89.00 USD", "69.00 USD", window, after),
("sale too high", "89.00 USD", "95.00 USD", window, during),
("currency mix", "89.00 USD", "69.00 EUR", window, during),
]
for label, price, sale, win, now in cases:
problems, effective = effective_price(price, sale, win, now)
amount, currency = effective
print(label + ":", problems, str(amount) + " " + currency)Running it prints:
during sale: [] 69.00 USD
after sale: [] 89.00 USD
sale too high: ['sale_price must be lower than price'] 89.00 USD
currency mix: ['sale_price currency differs from price'] 89.00 USDAvailability
availability accepts a fixed set of values. Use them exactly as written, in lowercase with underscores.
| Value | Meaning | Typical use |
|---|---|---|
| `in_stock` | Can ship or be picked up now | Normal sellable items |
| `out_of_stock` | Cannot be bought now, with no committed restock | Sold-out items you keep listed |
| `preorder` | Not yet released, can be ordered | New launches |
| `backorder` | Temporarily unavailable, can be ordered for later delivery | Items with a known restock |
For preorder and backorder, add availability_date so the system knows when the item can ship:
<g:availability>preorder</g:availability>
<g:availability_date>2027-01-15T09:00-0500</g:availability_date>The lifecycle below shows how one product typically moves between these values.
Availability is a per-variant fact. If the blue medium jacket is sold out but the blue large is not, each variant needs its own availability, and each variant's landing URL must show the same status. The previous chapter's item_group_id ties the variants together, but it does not share stock state.
Matching the page: structured data
The same facts must appear in your schema.org markup. The mapping is mechanical, but two points trip people up: JSON-LD uses full schema.org URLs for availability, and the price is a plain number string without the currency.
| Feed | JSON-LD (`offers`) |
|---|---|
| `price` or active `sale_price`, number part | `price` |
| Currency part | `priceCurrency` |
| `in_stock` | `https://schema.org/InStock` |
| `out_of_stock` | `https://schema.org/OutOfStock` |
| `preorder` | `https://schema.org/PreOrder` |
| `backorder` | `https://schema.org/BackOrder` |
| `sale_price_effective_date` end | `priceValidUntil` (date) |
During a sale, the price in markup should be the sale price, since that is what the visitor pays. If you want to show the original price too, publish it with a priceSpecification entry that marks it as a list price, and keep the main price as the current one.
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Acme Trail Runner Jacket - Men's, Blue, Medium",
"sku": "SKU-1001-BLU-M",
"offers": {
"@type": "Offer",
"url": "https://www.example.com/p/trail-runner-jacket?color=blue&size=m",
"priceCurrency": "USD",
"price": "69.00",
"priceValidUntil": "2026-11-30",
"availability": "https://schema.org/InStock",
"itemCondition": "https://schema.org/NewCondition"
}
}Common failures
- Price mismatch. The feed says
89.00 USD, the page says69.00because a promotion script updated only the page. Fix the source of truth so one system writes both. - Availability mismatch. The feed was exported at 02:00 and the item sold out at 09:00. Refresh more often for fast-moving stock, as the freshness chapter explains.
- Price only rendered by JavaScript. If the price appears on the page after a script runs, a crawler that does not run scripts sees no price. Server-render the price and markup.
- Currency or locale from geo-detection. A page that shows a different currency to the crawler than to your customers looks like a mismatch. Make the crawled version stable.
- Out-of-stock pages deleted. If you remove the page, the feed's link breaks. Keep the page, and mark the item
out_of_stockin both places. - Hidden fees. A price that excludes a mandatory charge shown only at checkout can be treated as misrepresentation.
Exercise
A feed item has price of 120.00 USD, sale_price of 95.00 USD, and sale_price_effective_date of 2026-12-01T00:00-0500/2026-12-05T23:59-0500. It is 2026-12-08 and the page shows 120.00 with InStock. The feed was last refreshed on 2026-12-03. What is wrong, which price should the JSON-LD show, and what should you change?
Show answer
The feed is stale. It still carries a sale that ended on 2026-12-05, so the feed implies 95.00 while the page shows 120.00, which is a price mismatch (some systems fall back to price after the window, but you cannot rely on that). The JSON-LD should show "price": "120.00" with "priceCurrency": "USD", matching the page. Refresh the feed, remove sale_price and sale_price_effective_date, and set the process that ends sales to update the page, feed, and markup together.