Fixing a missing google_product_category using OpenGraph tags

23 November 2019

Recently, as part of a Facebook Pixel/catalog(ue) setup, I had the job of adding microdata tags to a WordPress site. I settled on the OpenGraph protocol and added all the required tags listed on Facebook for Developers to the header of the site. But when I tested one of my tagged pages using the Facebook microdata debugger, I got a warning telling me "A product is missing a field: google_product_category".

Google Product Category misssing

Facebook for Developers had said nothing about this because it only listed the required tags - and google_product_category is optional (hence the debugger generating a warning rather than an error). Fortunately Google Merchant Center Help was more forthcoming, even providing an .xls download of all Google product categories.

But the Merchant Center Help did not explain how to add the product category using OpenGraph, or even if it was possible to do so. It took a Stack Overflow question and answer (both from the same user) to confirm that it was possible, using the form:

<meta property="product:category" content="">

In retrospect, I should have been able to work this out by looking at some of the other tags:

<meta property="product:brand" content="">
<meta property="product:availability" content="">
<meta property="product:condition" content="">

It's also worth noting that the content of the category tag can be either the category ID or the category name. Using the ID seems the easier option, not least because the category name has to be URL encoded AND it's necessary to give the full path.  Whereas using the ID is nice and simple, for example:

<meta property="product:category" content="888">


Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © James Clark
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram