Web Master
Web Master

Reputation: 11

How do I correctly define JSON-LD shippingDetails -> shippingDestination to exclude a list of states?

We have a business that can only ship product within California due to licensing restrictions. I am trying to define a JSON-LD Product that states that we ship to California and do not ship in all other states.

I thought I had it correct, because Google and Schema.org showed no errors. Screaming Frog says that I cannot have more than one shippingDetails for an offer. However, Schema.org says for shippingDetails:

Multiple of these entities can be used to represent different shipping rates for different destinations

Perhaps I need a shippingDetails array with one destination per array element, where that element represents a doesNotShip equal to true or false? This would mean an array of 50 shippingDetails, which seems very inefficient.

Here's the JSON-LD I created. I have removed the irrelevant sections and left what I thought was a logical structure based on doesNotShip being at the shippingDetails level. What I'm trying to imply is that we have an offer on the product where I can ship to this shipping destination, and I cannot ship to this list of destinations. Am I just misunderstanding the specification?

{
  ...
  "offers": {
    ...
    "shippingDetails": [
      {
        "@context": "https://schema.org",
        "@type": "OfferShippingDetails",
        "doesNotShip": true,
        "shippingDestination": {
          "@context": "https://schema.org",
          "@type": "DefinedRegion",
          "addressCountry": "US",
          "addressRegion": [
            "AL","AK","AZ","AR","CO","CT","DE","DC","FL","GA",etc....,"WY"
          ]
        }
      },
      {
        "@context": "https://schema.org",
        "@type": "OfferShippingDetails",
        "doesNotShip": false,
        ...
        "shippingDestination": {
          "@context": "https://schema.org",
          "@type": "DefinedRegion",
          "addressCountry": "US",
          "addressRegion": "CA"
        },
        ...
      }
    ],
    "priceValidUntil": "2024-12-31T23:59:59-08:00"
  },
  "@context": "http://schema.org",
  "@type": "Product"
}

Upvotes: 1

Views: 288

Answers (0)

Related Questions