Keep Google happy by providing product info in a form it can easily read.
I recently created a page for my new Maintenance Plans aimed at clients with WordPress sites. I am using the block editor for posts and I decided to use Atomic Blocks Pricing Table Block to list the features of the two plans I offer.
Within a few days I got an email from Google Search Console to recommend that I add schema information to the Maintenance Plans page because it had found two “products” on that page. I then noticed that the Pricing Table Block marks items as products. The email suggested visiting the Google Structured Data Markup Helper to get the required markup to add to your page.
A while later someone on the Genesis WordPress Facebook group got a similar email from Google Search Console and wanted to know how to fix the issue. I decided to write a little bit of code to generate the required JSON-LD code. It’s only a subset of the possible data but a WooCommerce product doesn’t necessarily provide must more that can be used.
In 2020 Google has added additional fields to this list of recommended fields e.g. aggregateRating (average rating of customer reviews). I have decided not to update my code as Google will likely keep changing things and I will always be lagging behind.
The code shows how to add fields and examples of how to get their values from the WooCommerce product object.