Blog

2019.11.30

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

In categories: Website development, Woocommerce, Wordpress

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 :)

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

 

Latest work