Hello,
Thanks for contacting us and sorry for the inconvenience caused.
The aggregateRatings and review properties are generated from the user reviews of your products. You don’t have to add them manually to the Schema. Please make sure that the reviews are enabled in WooCommerce settings and as soon as your products get a user review, our plugin will add it to the Schema. Here is a guide that can help: https://rankmath.com/kb/aggregate-rating-error/#filter
Hope that helps. Let us know if you need any other assistance.
Ok, but what about adding this field to the products “hasMerchantReturnPolicy”?
Hello,
Our developers are discussing this internally to get all the technical info correct and the best approach to possibly include this in the future as, at the moment, these properties are not available in our plugin.
The only possible way to add it would be to edit the following filter with the appropriate data for these properties so it gets included in the Product Schema as well:
https://rankmath.com/kb/filters-hooks-api-developer/#change-post-schema-data
We have created an example filter that would help add this data and it assumes that the refund policy is only applicable to the USA and that it has a 30-day refund period.
This would need to be changed according to the website specifications but it should be a good starting point:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
// Return policy
$entity['offers']['hasMerchantReturnPolicy']['@type'] = 'MerchantReturnPolicy';
$entity['offers']['hasMerchantReturnPolicy']['applicableCountry'] = 'US';
$entity['offers']['hasMerchantReturnPolicy']['returnPolicyCategory'] = 'https://schema.org/MerchantReturnFiniteReturnWindow';
$entity['offers']['hasMerchantReturnPolicy']['merchantReturnDays'] = 30;
$entity['offers']['hasMerchantReturnPolicy']['returnMethod'] = 'https://schema.org/ReturnByMail';
$entity['offers']['hasMerchantReturnPolicy']['returnFees'] = 'https://schema.org/FreeReturn';
return $entity;
});
And here’s a guide to adding the code to the website:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps.
Thank you.
You guys are wonderful! Thank you very much for your help. That’s what I was looking for. Do you have a documentation where I could find the names of your schemas? I mean for products you wrote this way: “rank_math/snippet/rich_snippet_product_entity”. I think you understand what I’m looking for.
Hello,
In the filter, you’ll just need to update the word product
with the type of schema you wanted to edit:
rank_math/snippet/rich_snippet_product_entity
We don’t have a list of all the schemas in Rank Math to use for that line. However, here’s the complete list of Rank Math’s predefined schemas:
https://rankmath.com/kb/rich-snippets/#schema-rank-math-and-pro
Hope that 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.