Hello,
Thank you for contacting Rank Math today.
It is possible to remove certain properties from the rich snippet. 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;
});
Looking forward to helping you. Thank you.
Thank you Michael, very much appreciated
Thank you Micheal, very much appreciated.
Brilliant! Just what I need, great timing!
To confirm, does this code only remove the price from the search engine listing?
I can still see the price in edit product/Rank Math and wanted to check.
Many thanks!
Hi @support90,
I am glad that this did the trick 🙂
@sarahrobinson yes this will only remove the price from the rich snippet and not the actual product.
I hope this info helps. Thank you.
The code does not prevent the price from appearing in the snippet. Can it be for the currency exchange plugin?
WOOCS – WooCommerce Currency Switcher
https://www.google.com/search?q=sofia+lapenta+pa%C3%B1uelo+limona&oq=sofia+lapenta+pa%C3%B1uelo+limona&aqs=chrome..69i57j33l3.6709j1j1&sourceid=chrome&ie=UTF-8
Thank you
-
This reply was modified 5 years, 2 months ago by
Elapenta.
Hi Elapenta,
I am sorry but it only works on the rich snippets generated by Rank Math.
If you need help with anything else, please open a new support ticket here so we can help:
https://support.rankmath.com
We are always here for assistance.