@vlad7
When i used the snippets you provided i was getting errors in console not warnings. Probably because i also use rating plugin and the meta generator plugin.
The file structured data creates aggregating snippets as standard but it uses the comments... Since only some people use the comments it will show no rating in google and for me personally, if there is 5 star in my search on google results i would visit that site first...
There is also no need to use extra snippets in themes because the file was there already so why invent the wheel twice.
Originally in structured data there is:
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "<?php echo round(osc_count_item_comments_rating(), 1); ?>",
"bestRating": "5",
"worstRating": "0",
"ratingCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>",
"reviewCount": "<?php echo (osc_count_item_comments() > 0 ? osc_count_item_comments() : 1); ?>"
}
<?php osc_run_hook('structured_data_footer'); ?>
}
</script>