Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

fix(schema): accept a list of offer priceSpecification objects

Rudy Celekli04911035ce91
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 648be42..382a1a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Fixed
+
+- **Merchant validation accepts a list of `priceSpecification` objects.**
+ Schema.org allows one price specification or several. A list crashed
+ `schema_ecommerce_validate.py` with `AttributeError` before any finding
+ was returned. Loyalty-tier detection now checks each object in the list.
+
## [2.5.0] - 2026-10-22
Security and accuracy fixes from a full audit, and Claude Desktop installs again.
diff --git a/scripts/schema_ecommerce_validate.py b/scripts/schema_ecommerce_validate.py
index 10653e1..6df87b5 100644
--- a/scripts/schema_ecommerce_validate.py
+++ b/scripts/schema_ecommerce_validate.py
@@ -100,6 +100,22 @@ def _all_types(payload) -> list[str]:
return types
+def _as_dicts(value) -> list[dict]:
+ """JSON-LD repeats a property as either one object or a list of objects."""
+ if isinstance(value, dict):
+ return [value]
+ if isinstance(value, list):
+ return [item for item in value if isinstance(item, dict)]
+ return []
+
+
+def _has_loyalty_price(offer: dict) -> bool:
+ return any(
+ spec.get("@type") == "UnitPriceSpecification" and spec.get("validForMemberTier")
+ for spec in _as_dicts(offer.get("priceSpecification"))
+ )
+
+
def _has_type(payload: dict, target_type: str) -> bool:
kind = payload.get("@type")
if isinstance(kind, str):
@@ -223,9 +239,7 @@ def validate(payload: dict | list, *, require_eu_energy: bool = False) -> dict:
# 6. Loyalty / MemberProgram visibility (Medium).
if not prod.get("hasMemberProgram") and not any(
- o.get("priceSpecification", {}).get("@type") == "UnitPriceSpecification"
- and o.get("priceSpecification", {}).get("validForMemberTier")
- for o in offers_list if isinstance(o, dict)
+ _has_loyalty_price(o) for o in offers_list if isinstance(o, dict)
):
findings.append({
"severity": "Medium",
diff --git a/tests/test_schema_v2.py b/tests/test_schema_v2.py
index fffa24a..a75d0b4 100644
--- a/tests/test_schema_v2.py
+++ b/tests/test_schema_v2.py
@@ -188,6 +188,32 @@ def test_validate_emits_info_when_no_product_group() -> None:
assert any("ProductGroup" in f["message"] for f in info)
+def test_validate_accepts_a_list_of_price_specifications() -> None:
+ """Offer.priceSpecification may be one object or a list. A list must not raise."""
+ product = _minimal_product()
+ product["offers"][0]["priceSpecification"] = [
+ {
+ "@type": "UnitPriceSpecification",
+ "price": 79.99,
+ "priceCurrency": "USD",
+ "validForMemberTier": {"@type": "MemberProgramTier", "name": "Gold"},
+ }
+ ]
+ result = ev.validate(product)
+ rules = [f["rule"] for f in result["findings"]]
+ assert "missing-member-program" not in rules
+
+
+def test_validate_price_specification_list_without_loyalty_is_reported() -> None:
+ product = _minimal_product()
+ product["offers"][0]["priceSpecification"] = [
+ {"@type": "UnitPriceSpecification", "price": 99.99, "priceCurrency": "USD"}
+ ]
+ result = ev.validate(product)
+ rules = [f["rule"] for f in result["findings"]]
+ assert "missing-member-program" in rules
+
+
def test_validate_finds_offers_when_offers_is_single_dict() -> None:
product = _minimal_product()
product["offers"] = product["offers"][0] # single dict, not list