Customizing the Schema.org product availability in Shopify for JSON-LD for SEO

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 tags

There are two product availability options that you can configure using tags directly in the app.

  • PreOrder
  • Discontinued

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

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

NOTE: As an example, we will use the PreOrder product availability when in stock and OutOfStock when they are out of stock. If you allow customers to continue purchasing even if the product is out of stock, the product availability will always show PreOrder. This applies when using product tags and setting the metafield for any of the product availability options.

Setting product availability with metafields

1. Using a metafields tool

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.

2. Find your product

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

3. 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)

You can use whatever 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.

Using Shopify's Metafields, we've created a definition as outlined by the settings.
Setting the Definition in Shopify’s Metafields
Assigning the metafield value to the product as PreOrder.
Assign the value to the product
NOTE: As an example, we will use the PreOrder product availability when in stock and OutOfStock when they are out of stock. If you allow customers to continue purchasing even if the product is out of stock, the product availability will always show PreOrder. This applies when using product tags and setting the metafield for any of the product availability options.

4. Test the new data

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

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

Reverting back to the regular product availability

If you need to revert back to the regular in-stock/out-of-stock availability, just find that metafield and delete it. JSON-LD for SEO will automatically revert back to the regular availability logic.

Back to blog

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.

Linking Llama

Link discontinued products to their best substitute. Keep discontinued products published on your website and continue to benefit from traffic to these pages.