Structured data is extremely valuable to have available on your site, especially for products. There are however valid cases where you may want to remove this structured data fully or partially.
In this post I’ll show how you can remove all structured data at once, but also how you can remove portions of the data such as only removing the stock or price information.
What is Structured Data?
Structured data ensures search engines like Google and Bing are able to show additional data in their Search Engine Results Page (SERP) such as the product price, stock and product review information.
Having this additional data available in your SERP listing can do wonders for your Click Through Rate (CTR) and conversions. Especially if you’re offering competitive pricing and/or exceptionally good reviewed products.
Compare the following structured listing with the same listing without any structured data.
Structured Data in WooCommerce
WooCommerce offers all of the shown strucutured data above and more by default. Here’s a full list of all the structured data;
- Product (includes pricing, stock and aggregated ratings)
- Review (individual review markup)
- Breadcrumbs
- Website
- Order
Removing Structured Data
To remove structured data you can use and implement some code snippets listed below.
Removing All Product Structured Data
The following snippet removes all the structure data for the products.
Removing Price Structured Data
Removing Stock Structured Data
Removing Review Structured Data
Review structured data is only added when a product has at least 1 review and when the current setting in your store is set to allow/enable review ratings. That is one way to disable the structured data, but if you still want to remove it through a code snippet, the following can be used.
Thanks this post, can you can upload code remove Breadcrumbs WooCommerce !
+1, I need it too .-)
I added the following to remove the price per the instructions on your other blog entry but nothing happened. Did I do something wrong?
/**
* Remove partial product structured data.
*/
function ace_remove_partial_product_structured_data( $markup_offer, $product ) {
$markup_offer = array(
‘availability’ => ‘https://schema.org/’ . ( $product->is_in_stock() ? ‘InStock’ : ‘OutOfStock’ ),
‘url’ => get_permalink( $product->get_id() ),
‘seller’ => array(
‘@type’ => ‘Organization’,
‘name’ => get_bloginfo( ‘name’ ),
‘url’ => home_url(),
),
);
return $markup_offer;
}
add_filter( ‘woocommerce_structured_data_product_offer’, ‘ace_remove_partial_product_structured_data’, 10, 2 );
Be aware that this removes structured data from the product page – which is data that is only read/shown by bots, they are not elements visible on the page, so nothing should really appear to happen (unless you’re talking about nothing happening to the structured data beneath)
Hi,
I added the code to the php file and resubmitted my site for google to index but nothing happened – price and stock info is still in the search results.
How does does it typically take before the pricing data is removed from the Google search results?
Thanks,
Tim
Hi Tim,
Hard to give a good estimate, it varies greatly with Google depending on your site. It can easily be 3+ months, or just 1 month or even a day..
Cheers,
Jeroen
Thanks so much for the fast response. It looks like the code wasn’t added before. But when I add it now my site gets hosed. I get the following error
Parse error: syntax error, unexpected ‘<', expecting end of file in /home3/p0vlp3ls/public_html/wp-content/themes/pro-child/functions.php on line 26
Fatal error: Exception thrown without a stack frame in Unknown on line 0
Hi Tim,
That error could happen when the snippet was implemented incorrectly: https://aceplugins.com/how-to-add-a-code-snippet/
Cheers,
Jeroen
Is there a way to remove only the “high price” from the price data? I have a variable product with a large price range and I would prefer google to show only 1 price (the “low price”). Thanks!
is this still valid? can you update for 2021?
Hi Lola,
I’ve reviewed this and it should still work in 2021 :-)
Cheers,
Jeroen
Does it works in 2023? and can i insert the code in code snippets PHP just? do i need to resend a sitemap for it to start working
Hi Rene,
No reason to believe it won’t work :-)
My preferred way of adding PHP code snippets it to the child theme functions.php, but other options are to use a PHP snippet plugin.
Not sure if resubmitting is required, but probably wouldn’t hurt.
Cheers,
Jeroen