Fix collection canonicals and product schema offers
Shopify renders collection pages at multiple filter and pagination URLs. Keep one canonical per collection, canonicalize filtered views to the base when they are not meant to rank, and emit Product markup whose offers match the real price, currency and availability shown in the buy box.
Why this matters
One canonical per collection, and offers that match inventory.
Before you start
- Shopify theme with editable Liquid files
- Product and variant inventory data available in the theme context
How to apply it
Audit the current canonical output
Open theme.liquid and the collection template, then fetch one collection with curl. Count rel=canonical tags and check whether the href is absolute and points at the requested collection.
Check: curl -s your production domain/collections/<handle> | grep -c 'rel="canonical"' returns exactly 1.
Set one canonical per collection
Keep the theme canonical_url for the base collection and remove app or snippet tags that emit a second value. Point filtered and sorted variants at the base collection unless the view is intentionally indexable.
Check: The filtered collection URL lists the base collection as canonical and returns 200.
Emit Product offers in JSON-LD
In sections/product-template.liquid or snippets/product-schema.liquid output offers with price, priceCurrency, availability from product.available and an absolute url for the product.
Check: The Product JSON-LD includes offers.price, offers.priceCurrency and offers.availability.
Match availability to inventory
Map product.available to InStock and OutOfStock, including variant-level availability when the buy box shows a single variant. Update the snippet so every product template inherits it.
Check: For one in-stock and one sold-out product, JSON availability matches the page button state.
Confirm after deploy
Fetch the collection and product on the live theme, parse the JSON block and compare price and availability with the page. Then check the Product snippets report in Search Console.
Check: curl -s your production domain/products/<handle> | grep -c 'application/ld+json' is at least 1 and the block parses.
Source: seo-mcp playbook · curated entry · report an error
Framework notes
shopify
Override `canonical_url` once in `theme.liquid` and render Product JSON-LD from `snippets/product-schema.liquid` so every product template inherits the same offers object.