How do I correctly markup a Product within an Offer within a Product?

萝らか妹 提交于 2019-12-06 03:54:27

Based on your example it seems that each Offer is a variant of Product. If that's the case, I'm not sure nesting Product inside of a variant would be needed. As far as I can tell from your example the only property in the nested Product which is unique is weight, which you could apply to Offer using additionalProperty.

If sent this way to the tool everything will validate:

{
  "@context": "http://schema.org/",
  "@type": "Product",
  "name":"Stripe Knit Sweater",
  "url":"http://foobar.gov/product",
  "image":[
      "http://foobar.gov/product/image1"
  ],
  "description":"this is a description",
  "brand":{
      "@type":"Thing",
      "name":"My Store"
  },
  "offers": [
      {
          "@type": "Offer",
          "availability":"http://schema.org/InStock",
          "price":"64.0",
          "image":"http://foobar.gov/product/url",
          "name":"Small / Blue/Black/Cream Stripe",
          "priceCurrency":"USD",
          "url":"http://foobar.gov/product/url",
          "additionalProperty": {
              "@type": "PropertyValue",
              "name": "Weight",
              "unitCode": "1b",
              "value": "0.0lb"
          }
    },
    {
        "@type": "Offer",
        "availability":"http://schema.org/InStock",
        "price":"64.0",
        "image":"http://foobar.gov/product/url",
        "name":"Medium / Blue/Black/Cream Stripe",
        "priceCurrency":"USD",
        "url":"http://foobar.gov/product/url",
        "additionalProperty": {
            "@type": "PropertyValue",
            "name": "Weight",
            "unitCode": "1b",
            "value": "0.0lb"
        }  
    }]
}

Googles Schema Documentation on Offer states that itemOffered is a recommended field and that it's "typically a product", but doesn't have to be. It's also worth noting that contrary to the documentation, the tool does not warn you if itemOffered does not exist in Offer

Even though schema.org provides itemsOffered as an option unfortunately there is no example of that with nested Products.

Nesting Products or Services could make sense in the following scenarios:

  • (Product) Salon Package
    • (Offer) Nail/Massage Combo
      • (ItemOffered)
        • (Service) Nail polishing and Neck Massage

or:

  • (Product) Sweater
    • (Offer) Blue Sweater
      • (ItemOffered)
        • (Product) Blue Sweater
          • (Offer) Blue Sweater on Amazon - $49
          • (Offer) Blue Sweater on eBay - $39
    • (Offer) Red Sweater ...

Either way, I think the expectation makes sense here, the Product in any scenario will eventually end with Offer. In your case, I believe the fix would be to not use nested Products only to describe the Offer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!