首页 > 解决方案 > SDTT 警告:“Google 无法识别 Product 类型对象的属性 priceSpecification。”

问题描述

我有以下 JSON-LD 并试图代表一种按月付费的产品,例如包含预付费用和月费的手机合同。

当我尝试添加时unitCode,我收到以下警告:

priceSpecificationGoogle 无法识别类型为 的对象的属性Product

{ 
  "@context": "https://schema.org/",
  "@type": "Product",
  "name": "Apple iPhone",
  "image": [
   "https://example.com/photos/1x1/photo.jpg",
   "https://example.com/photos/4x3/photo.jpg",
    "https://example.com/photos/16x9/photo.jpg"
 ],
"description": "Apple iPhone XS ...",
 "sku": "0446310786",
 "mpn": "925872",
 "brand": {
  "@type": "Thing",
  "name": "ACME"
   },
  "review": {
   "@type": "Review",
  "reviewRating": {
  "@type": "Rating",
  "ratingValue": "4",
  "bestRating": "5"
  },
"author": {
  "@type": "Person",
  "name": "Fred Benson"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.4",
"reviewCount": "89"
 },
 "offers": {
"@type": "Offer",
"url": "https://example.com/anvil",
"priceCurrency": "GBP",
"price": "39.99",
"priceValidUntil": "2020-11-05",
"itemCondition": "https://schema.org/UsedCondition",
"availability": "https://schema.org/InStock",
"seller": {
  "@type": "Organization",
  "name": "Executive Objects"
}
},
"priceSpecification": {
    "@type": "UnitPriceSpecification",
    "price": "25",
    "priceCurrency": "GBP",
    "referenceQuantity": {
      "unitCode": "MON"
    }
  }
  }

标签: schema.orgjson-ld

解决方案


您需要将priceSpecification属性添加到Offer,而不是Product

{ 
  "@context": "https://schema.org/",
  "@type": "Product",

  "offers": {
    "@type": "Offer",

    "priceSpecification": {
      "@type": "UnitPriceSpecification"
    }

  }

}

您可以在其页面上找到属性的预期域/范围。对于priceSpecification,它说:

用于这些类型
Demand
Offer
TradeAction

因此,预计不会在Product.


推荐阅读