-
How to remove pricing information from Woocommerce product schema so that it does not show in google search results.
-
Hello,
Thank you for contacting Rank Math today.
You can add the following code to your theme’s functions.php file to remove the price:
/** * Filter to Short-circuit Schema if a 3rd party is interested in generating their own data. * Replace $schmea_type with schema name like article, review, etc. * @param array $entity Snippet Data * @return array */ add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) { unset($entity['offers']['price']); return $entity; });
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hi, I am selling software products through woocommerce. The default schema picked up by rankmath is woocommerce product schema. Is it more appropriate to choose a software schema in my case? Also what schema type you are using at rankmath as you are also using woocommerce and selling software plugins.
Hello,
If you are selling a certain product, no matter it’s a physical or a digital product, it is recommended to use a product schema for it. Since you are removing the pricing in the schema, could you please let me know if you are using catalog mode for your products?
As for the software schema, this schema applies to software products that you are writing articles or content for.
I hope that helps you with your concern.
Looking forward to helping you.
Hi,
Yes, I am using catalogue mode to take quotes from the customers. I have set dummy prices for the backend (like Rs. 1 & Rs. 0). A zero price allows for free download and a dummy price of Rs. 1 allows for quote requests. Please refer to this screenshot to know how my product looks in the search results. There are no reviews yet so I think reviews are not showing up. I just want to show the reviews and nothing else in the search results. The ‘price’ and ‘in stock’ both should not be visible on search results. There is no quantity limitation for digital products so ‘in stock’ does not make sense.Hello,
Please note that in order to pass the Rich Results Tests your product needs to have either reviews or an offer with the price. If you don’t have any on your products it won’t pass validation and the Schema won’t show on SERPs.
Please make sure that you have either of those properties to be eligible for Rich Results.
Don’t hesitate to get in touch if you have any other questions.
As and when reviews are posted, they will come up in rich snippets I guess. For now, I need to remove the ‘price’ and ‘in stock’ in the results.
Hello,
Sure, although that is not recommended you can use the following filter to remove that from the Schema:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) { unset($entity['offers']['price']); unset($entity['offers']['availability']); return $entity; });
After adding that you can test the products with the Schema Validator here: https://validator.schema.org
It might take some time for Google to update the Search Results to show this new change so please allow some time for Google to crawl the website and see the updated Schema markup.
Don’t hesitate to get in touch if you have any other questions.
Has rankmath also removed the price and availability from search results? Look at the image attached. https://ibb.co/C6CK9Yx
Looks like Rankmath has just set the price to zero and google has hidden the offer section from schema. I have set a dummy price of Rs 1. Can the above filter be adjusted to return 0 for all prices?
Hello,
You just need to instead of unsetting the price using a value there like so:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) { $entity['offers']['price'] = 100; //Change the value here unset($entity['offers']['availability']); return $entity; });
Don’t hesitate to get in touch if you have any other questions.
it’s not working bro. Both the unset and the other code given. it still shows the price and availability in the schema validator link provided by you. Refer image. https://ibb.co/X5b00Sm
Hello,
The filter mentioned before is used for simple products but you are using variable products on your website.
For those products you can use the following filter to set the prices of all offers to zero:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) { unset($entity['offers']['availability']); $entity['offers']['lowPrice'] = 0; $entity['offers']['highPrice'] = 0; return $entity; });
Don’t hesitate to get in touch if you have any other questions.
This is the code i am using
//Set Rankmath Schema Price to Zero for all products add_filter("rank_math/snippet/rich_snippet_product_entity", function($entity) { //unset($entity['offers']['price']); $entity['offers']['lowPrice'] = 0; $entity['offers']['highPrice'] = 0; //unset($entity['offers']['availability']); return $entity; } );
The issue is still not resolved.
Refer image – https://ibb.co/FYVT5SjHello,
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
It is working now. Looks like it was a cache issue yesterday.
Thanks for the help.
The ticket ‘Woocommerce schema remove pricing’ is closed to new replies.