Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
As a workaround, you can add the following PHP code to your theme’s functions.php file to set a specific date for the sale price:
/**
* Filter to modify Rank Math product schema data
* Replace $schema_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 ) {
$entity['offers']['priceValidUntil'] = '2050-01-01';
return $entity;
});
Alternatively, you can also use the below code to remove the offers schema if you do not have any offers on your products:
/**
* Filter to modify Rank Math product schema data
* Replace $schema_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 ) {
//remove offer data from the product schema
unset($entity['offers']);
return $entity;
});
Looking forward to helping you. Thank you.
Fantastic. I added the 2nd box of code you sent.
Is there anything I can do to remove the similar “review” & “aggregate rating” error? I don’t want to clog up my site with reviews and I have too many products that currently are overwritten semi-regularly due to imports which means reviews are often wiped with them and therefore serve little purpose.
Hi Mark,
Thanks for the follow up.
This is not recommended practice since Google expects this data to be available in your product snippet.
Rank Math takes the schema data from your product pages automatically and turns it into Schema-ready content. Likewise, the aggregateRating and review fields are taken from your actual product reviews that your buyers/customers leave on your products.
http://i.mythemeshop.com/cIBqH4
If you would however wish to go down this path, you can add the following code to your theme’s functions.php file:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
//remove reiew & aggregateRating data from the product schema
unset($entity['review']);
unset($entity['aggregateRating']);
return $entity;
});
I hope this info helps. 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.