How to edit structured data in WooCommerce without a plugin. Adding brand, review and aggregateRating.

Just came back from a new project of mine. I signed it up for Google Search Console (ex Webmaster Tools) and today got an email that began with “Products issues detected on..” and they gave me a list of these structured data warnings I should take care of:

  • No global identifier provided (e.g. gtin, mpn, isbn)
  • Missing field ‘brand’
  • Missing field ‘review’
  • Missing field ‘aggregateRating’

A bit later I learned that luckily they all were related to product’s structured data which is not a huge error but rather a nice suggestion from Google that I should fix them to make my products look and work better in the search results.

What is structured data and why it matters

There is so much content and information on the internet. Search engine bots require additional information to understand what the page is about, to categorize it and know how to display it. This is where structured data comes into play. With this information we are able to explicitly describe the things we sell or display on the internet. This data is like a clue for search engines that tells that this page has a product, this is its title, here is the price and these are its reviews, etc.. It’s basically a standard of providing information.

Structured data actually allows to describe a lot of different types of information, not just products but also books, articles, events, places, organizations, people etc. You can learn more about schema here.

Product data in WooCommerce

We have looked at this data now and can get back to my issue. So Google said that I have issues with my product’s structured data which means that my WooCommerce product hasn’t got all of the information that there should be.

WooCommerce is amazing – it automatically adds this data to each product you are selling and in most case you don’t have to worry about it. However in my particular case the product had ratings and reviews which were pulled in from another platform. That’s why WooCommerce was having hard time automatically adding ‘review’ and ‘aggregateRating’ values to the product schema. Also I wasn’t able to find if WooCommerce has an option to add ‘brand’ to the product schema therefore I had to find a way to integrate this information into my products.

How to add or edit structured data in WooCommerce

I must admit I spent a lot of time looking where and how could I hook into WooCommerce to filter the structured data. At one point was even almost calling it quits but in the end after digging deep in the documentation managed to find a solution. Here is a snippet you can add to your functions.php to add the missing fields:

If you would like to edit existing structured data fields, the best option would be to use WooCommerce admin panel and edit the data of your product however if for some reason this is not an option, you could just use the same function above and add the field you would like to change there like so:

And as easy as that – you have taken care of your product data without using any fancy-shmancy plugins.

Bonus tip – how to disable / remove default WooCommerce structured data

In case you are looking to use a WooCommerce plugin for your data or in any other case if you would like to remove or disable JSON-LD structured data at all – you could use this snippet in your functions.php file.

Hope this helps to up your search engine and structured data game in WooCommerce. Please do let me know in the comments below if you have any additional questions or would like to share whatever it is you would like to share :)

In categories: Website development, Woocommerce, Wordpress

Nauris Kolāts

Nauris is a freelance designer / developer who loves to dig into the UX as much as in the ground for fishing worms. And fishing is just one amongst the long list of his active lifestyle hobbies.

Other posts

Your thoughts

Join the discussion

  1. Sebastian Velandia

    Holy shit this is amazing thank you !!

  2. Soenarto

    You wrote very well and the four warnings that you found were exactly the problem I experienced. But, how can the code above work for different products?

    Thank you in advance

    • Hi Soenarto, thanks for your question. The code above should work for all kinds, categories and types of products in WooCommerce.

  3. Angel

    Thank you very much for sharing it, I have been looking for this problem for a long time and you did not find it. 3 problems were solved for me (brand, review and aggregateRating) but there is another one that cannot solve it and I don’t know how to add it, it is No global identifier is provided (for example, gtin, mpn, isbn). Would you have the solution? Thank you

    • Hi, thanks for your comment.
      Since ISBN, MPN and GTIN all are custom fields and WooCommerce doesn’t support them by default, I’m afraid you will require to find a custom development solution for this.

Latest work