Customizing the Schema.org product availability in Shopify structured data

By Ilana Davis

Shopify products are assumed to be either in stock or out of stock depending on their inventory levels.

That’s usually good enough for most stores but sometimes you need more options. Especially with Google Merchant Center where you might be running ads for preorders.

Product availability options

By default, JSON-LD for SEO will use the data from Shopify for your product’s availability. That will be either InStock or OutOfStock.

If you’d like to use a different option, JSON-LD for SEO supports all of the ItemAvailability options in Schema.org. At the time of this writing, those are:

  • BackOrder
  • Discontinued
  • InStock
  • InStoreOnly
  • LimitedAvailability
  • OnlineOnly
  • OutOfStock
  • PreOrder
  • PreSale
  • SoldOut

If you’d like to change the availability of an item to be different than the standard InStock/OutOfStock, here’s how.

Setting product availability with Shopify tags

There are two product availability options that you can configure using tags directly in the app. Note that this will apply to every product with the assigned tags.

  • PreOrder
  • Discontinued

Let's say you have a product that's available for preorder. There's no way in Shopify to set the product as a preorder, so we have to customize the structured data to match your product feed for Merchant Center.

Create a tag in Shopify which will be used to set which products are available for preorder in Shopify. Then add this tag to the PreOrder Tag field in JSON-LD for SEO.

For example, if you have a tag in Shopify for Pre-Order Test, a product with that tag will use the PreOrder product availability.

Optional product availability settings within JSON-LD for SEO. Includes additional availabilty options with tags for PreOrder and Discontinued

A few important pieces to note. Please also reference Shopify's inventory policy section below. This applies when using product tags and setting the metafield for any of the product availability options.

  • The product availability will always show PreOrder if you don't track inventory in Shopify.

  • The product availability will always show PreOrder if you allow customers to continue purchasing even if the product is out of stock. Shopify inventory policy setting to track inventory and continue selling when out of stock.

  • If you do not allow customers to continue purchasing when the product is considered out of stock in Shopify, we will use the PreOrder product availability when in stock and OutOfStock when they are out of stock.

Setting product availability with metafields

JSON-LD for SEO uses Shopify metafields to configure the availability. Metafields are a common way to store extra data about things that Shopify hasn’t built a user interface for yet.

Metafields tools allow you to create, update, and manage the metafields for your store.

You can use Shopify’s Metafields or your metafield tool of choice.

Using the tool, find one of the products you want to customize.

Create a new metafield

Once you’ve found the product with the metafield tool, you’ll want to add the following data. Let’s say you wanted to mark it as a PreOrder product, you’d set the value to PreOrder.

namespace: jsonld
key: availability
value: PreOrder
type: string (some tools might not use the type field)

NOTE: Using the metafield approach will always show the product with the value you set (e.g. PreOrder) and will never check if the product is out of stock.

You can use whatever product availability type you want from Schema.org’s list above. Just use the value (PreOrder) and not the full URL (https://schema.org/PreOrder), JSON-LD for SEO will automatically add the URL part for you.

This is case sensitive so make sure you type it in as listed in the bullet point list above.

I’ve included an example below using Shopify’s Metafields.

First, set the definition in Shopify's metafields.  Using Shopify's Metafields, we've created a definition as outlined by the settings.

Then assign the value to the product.

Assigning the metafield value to the product as PreOrder.

Test the new data

Once that’s done you can test the product in Rich Results Testing Tool. You should see the availability updated there right away.

Then you’ll have to wait for Google to recrawl and reanalyze the page. Once that happens, you should be good to go.

With any luck, it won't be long before Google shows your preorder status directly in search results!

Rich Result showing Preorder status

Shopify's inventory policy

Within each product in Shopify, you can track inventory. If you want to allow customers to buy the item when it's out of stock, select continue selling when out of stock.

This will always show the product as in stock and allow customers to buy the product whether it's in stock or not.

Shopify inventory policy setting to track inventory and continue selling when out of stock.

For those with advanced needs for Merchant Center, you can use JSON-LD for SEO to ignore your Shopify inventory policy. This isn't needed for most Shopify stores but the option is there if you need it.

Optional product availability settings within JSON-LD for SEO. Includes settings for Shopify overbuying/backorder.

When this setting is enabled, if the inventory level is 0 or below, the product structured data will be OutOfStock. This effectively ignores your inventory policy in Shopify even if customers are allowed to buy when a product is unavailable (backorder).

For example, you might want to show an item as in stock still on your online store for organic buyers but need to show it as out of stock for Google's Merchant Center to pause ads. With this setting, as soon as all of the inventory is sold or spoken for, the structured data will update to show it as OutOfStock.

Reverting to the regular product availability

If you need to revert to the regular InStock/OutOfStock availability, find that metafield you created above and delete it. If you used the tag approach, delete the field in the app. JSON-LD for SEO will automatically revert to the regular availability logic.

JSON-LD for SEO

Get more organic search traffic from Google without having to fight for better rankings by utilizing search enhancements called Rich Results.