• I have long been applying a filter to woocommerce_structured_data_product in my wordpress functions.php to add additional schema.org information not included in the default woocommerce package.

    As of today (12/15/20) Google Search Console has informed me that none of my products contain any of my additional product information and upon further inspection, all additional data added by filter to woocommerce_structured_data_product has been completely removed.

    can somebody comment on what has changed in the structure of woocommerce_structured_data_product or why this functionality was removed so I can beging work to fix this?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @plcexchange!

    The most recent changes we’ve made to structured data was to add the missing “bestRating” and “worstRating” params to structured schema data, and that was in March this year.

    The filter you are referring to is still working and can be used as per https://github.com/woocommerce/woocommerce/wiki/Structured-data-for-products

    Have you by any chance added any other similar plugins or code recently that may have affected this?

    Cheers!

    Thread Starter plcexchange

    (@plcexchange)

    Rynald0s,

    Thanks for responding. So I have not added any new plugins to my site for a few months at least. I only noticed this issue because google search console started warning me that my products were missing rich data (that I had added previously) starting 12/14. When cross-referencing that date to my website plugins the only thing I can really tell is that woocommerce updated ~1 week ago. Unfortunately WordPress.com auto-updates a large majority of plugins so I cannot really pinpoint what other plugin was updated during that time.

    Ok so the technical stuff. Comparing notes to how the site you linked does the filter the only difference I see is they pass-through of the $markup and $data variable which are missing from my format. Here is an example of my original unmodified code that was working Pre 12/14/2020:

    
    function custom_woocommerce_structured_data_product ($data) {
    	global $product;
    	
    	$data['brand'] = $product->get_attribute('Manufacturer') ?? null;
    	$data['upc'] = $product->get_attribute('upc') ?? null;	
    
    	return $data;
    }
    
    add_filter( 'woocommerce_structured_data_product', 'custom_woocommerce_structured_data_product');

    As you can see in the add_filter call, I do not pass a $markup or $data variable, although originally it was working by appending the additional information to $data; any thoughts on the structure change between what I was doing and the suggestion you posted?

    On a side bar, I have actually already fixed it by adding additional code to build a second rich text script to add the missing data, but I want to understand why this is happening all of the sudden.

    Thread Starter plcexchange

    (@plcexchange)

    Also to add now that you are speaking about plugins; I now notice I have “Brands” under products (and when I go to edit a specific product) I can now add “brands” to products which I do not remember installing (and never use).

    Google tells me this is a plugin that I cannot find is installed anywhere. It also appears to be causing some table format errors when I browse all my products as seen in the picture below. Any thoughts on this?

    https://plcexchange.net/wp-content/uploads/2020/12/brands.jpg

    • This reply was modified 3 years, 11 months ago by plcexchange.
    • This reply was modified 3 years, 11 months ago by plcexchange.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘removed woocommerce_structured_data_product modification?’ is closed to new replies.