Hello,
Thank you for contacting Rank Math.
The Instock and Price in your snippets are generated from the availability, lowPrice and highPrice properties in your product schema. Other than the lowPrice, the others are recommended, not required properties, you can check that here: https://developers.google.com/search/docs/data-types/product. With this in mind, you can modify the product schema to only show the lowPrice and hide the availability. You can use this filter to achieve this:
/**
* Filter to add Brand Name for Products.
*
* @param array $entity Snippet Data
* @return array
*/
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
return $entity;
});
Hope that helps. If you have any further question(s), please let us know. Thank you.
Hi Micheal,
I want to hide the price and availability completely on SERP. How can I use the snippet to do that?
Also since Google already has the ich snippet displayed, I assume if I enter the code snippet now, after the next crawl, Google will honor and remove the price and availability?
Hello,
Please try the following code:
/**
* Filter to mod product schema.
*
* @param array $entity Snippet Data
* @return array
*/
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
if ( isset( $entity['offers']['availability'] ) ) {
unset( $entity['offers']['availability']);
}
if ( isset( $entity['offers']['highPrice'] ) ) {
unset( $entity['offers']['highPrice']);
}
return $entity;
});
Looking forward to helping you. Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.