Fix for WooCommerce schema data missing brand and mpn

Today I came across and issue where Google Search Console was complaning products “brand” and “mpn” where missing from the products schema / rich snippets data. You can checking using the rich snippet testing tool by Google found here.

I fixed my issue by adding a WordPress filter using the “woocommerce_structured_data_product” filter option. This allows you to add new data to the already generated WooCommerce data.

This is an example. You will need to change for your implementation.

Leave a Reply

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.


  1. Awilkerson

    Nice, thanks, I’ll have to try this when I get time. Every little error in search console stresses me out these days so I need all the help I can get, thanks for sharing.

    • Glad it can be of help! I am the same, I have another project where it is complaining about comments / feedback not being provided so may update this code to fix that issue as well in the future.

  2. Great solution! I’m happy with using default woocommerce rich snippets. Thanks

  3. Sam

    In which theme file do I copy this code in? functions.php? header.php?

    • Code should always go into the functions.php file, you should never be adding action and hooks into any other file.

      • Sam

        Thank you. Worked like a charm. Did you find that fix for google’s warnings about products without reviews? Or should we just plainly disable reviews from our products?

        • No I never looked into it further, I do ignore them at the moment, its mainly moaning if there is no product reviews, once the product has reviews the warnings disappearing.

        • Rad little hack to fix the MPN issue…especially since I don’t have a GTIN or UPC code. Regarding the product review schema errors, the best way to fix that issue is to get reviews for your products! In the event you can’t, I suppose you could leverage the example given for the MPN code and swap it out for reviews and aggregateRatings errors you may be having. You could also manually add a review for each product from the product edit page.

          • Thanks, I think as long as you provide the reviews and aggregateRatings fields with 0 value it should remove the “warning” flag from Google. However adding manual / fake reviews againsts products I am not sure if thats the best solution, could upset people and if you have thousands of products its not ideal / quick fix.

Next ArticleWindows 10 Subsystem for Linux Ubuntu