Adventures with product availability standards in WooCommerce
One of the key things that the Yoast SEO plugin does is output rich, structured data on each page on a site. This allows data consumers like Google, Facebook, and Pinterest to more easily read and extract key product information, and to reward sites with rich listings and integrations.
Building and maintaining that functionality boils down to finding a ‘middle ground’ between:
- the content and data available on/in a users’ website,
- Schema.org and Open Graph definitions (of entities like products, offers and reviews),
- the specific standards/requirements of each external consumer (Google, Facebook, Twitter, and so on).
That last part is particularly tricky, because each consumer of structured data decides how they will interpret Schema.org and Open Graph definitions, and, their approaches often differ in the details. For example; Facebook and Google have very different opinions on which attributes of a product are required, and which are simply optional. Meanwhile, Facebook and Pinterest often require different Open Graph tags, with different values.
For almost every ‘standard’, each platform requires slightly different information, in a slightly different format – and some of those requirements come with inherent conflicts. It’s impossible, for example, to satisfy Facebook and Google when describing a product with variations (e.g., a t-shirt in multiple colours or sizes). At the time of writing, the way in which each platform interprets Schema.org markup and Open Graph meta tags makes it technically impossible to meet the requirements of both.
Because of these types of challenges, we spend a lot of time trying to find the best approach to each use case and setup; we look for nuggets of information and workarounds in the documentation, experiment with testing tools, and dig around in edge-cases.
In most cases, we can find good compromises which satisfy the needs of each platform without creating undue complexity. But when you get into the details of ecommerce and product markup, we run into some particularly gnarly problems.
Product availability is a mess
Recently, we realised that we weren’t completely happy with how we were handling product availability data in our WooCommerce SEO plugin. We’d rewritten a bunch of legacy code, and in the process, we’d started to challenge some of the decisions we’d made in the past; particularly when it came to some of the Open Graph values.
To make sure that we were offering the best solution to our users, we wanted to go back to the drawing board, and make sure that we really understood all of the nuances around product availability.
What’s the challenge?
In the simplest cases, a product is either in stock or out of stock. But those aren’t the only options. In the real-world, for example, a product might be ‘on back order‘, ‘coming soon‘, ‘discontinued‘, or ‘online only‘ (and in some cases, even combinations of these).
Now things start to become complicated. The two main standards we need to support – Schema.org markup and Open Graph tags – don’t have equal support or consistent definitions for many of these scenarios. For example, there’s no direct equivalent of the Open Graph definition of ‘pending‘ (or ‘backorder‘) in Schema.org markup.
On top of this, each consuming platform (Google, Facebook, Pinterest, Twitter, etc) has different specifications when it comes to how they prefer to consume availability information (e.g., Schema.org markup vs Open Graph tags; and the different priorities between these), and, the specific types of availability values that they’ll accept. Often, these diverge from the formal Schema.org and Open Graph specifications in inconsistent and arbitrary ways.
Furthermore, the documentation of those platforms changes regularly – and often isn’t well-maintained. Even in the process of writing this post, I’ve discovered discrepancies, broken links and pages, and inconsistent information emerging within the course of days. In some cases, documentation is just deleted. In others, there’s simply no information for some key standards and properties.
It turns out that describing whether or not a product is in stock can be surprisingly complex, and that we were long-overdue a deep-dive to make sure that our implementation choices in our WooCommerce SEO plugin were as robust and up-to-date as possible.
Our new standards
We’ve dug deep through all of Schema.org, the Open Graph standard, and every single page of Facebook, Pinterest and Twitter’s documentation on rich results and structured data.
…And we still have a headache!
The good news is that we found some scenarios where we’d made some opportunities for improvement around availability, which we’ll address in future updates.
When a product is in stock
- We don’t currently output a
og:availability
meta tag. - We’ll add one, with a value of
instock
.
New meta tag:
<meta property="og:availability" content="instock" />
When a product is out of stock
- We don’t currently output
product:availability
orog:availability
meta tags. - We’ll add both, each with a value of
out of stock
.
New meta tags:
<meta property="product:availability" content="out of stock" />
<meta property="og:availability" content="out of stock" />
When a product is out of stock but is set to allow back ordering
- We currently set a
product:availability
value ofin stock
. This will be changed toavailable for order
. - We currently set the
availability
property of the schemaOffer
tohttp://schema.org/InStock
. This will be changed tohttps://schema.org/PreOrder
- We’ll also add a
og:availability
tag with a value ofbackorder
.
Old meta tags:
<meta property="product:availability" content="in stock" />
New meta tags:
<meta property="product:availability" content="available for order" />
<meta property="og:availability" content="backorder" />
There’s more on the horizon
Now that we’ve delved deeper than ever before into product markup, we want to go even further! We’ve spotted opportunities to make loads more tweaks and enhancements to our Open Graph tags, meta tags, and Schema.org markup. All of these will help Google, Facebook and others to better understand the fine-grained nuances of those products, which should translate into extra exposure, visitors and sales!
We’ll be adding some of those new features and improvements to our roadmap over the coming months – you can keep an eye on our plugin changelogs for news on what we’re adding, and keep your plugins up to date to take advantage of the latest features!
Coming up next!
-
Event
Wordcamp Asia 2025
February 20 - 22, 2025 Team Yoast is at Attending, Sponsoring, Yoast Booth Wordcamp Asia 2025! Click through to see who will be there, what we will do, and more! See where you can find us next » -
SEO webinar
Webinar: How to start with SEO (December 3, 2024)
03 December 2024 Learn how to start your SEO journey the right way with our free webinar. Get practical tips and answers to all your questions in the live Q&A! All Yoast SEO webinars »