EDD product rating in schema

#428632
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    It seems that the plugin you mentioned saves the data in the postmeta table under the key yasr_overall_rating so you could potentially apply the following filter to get that data into the Review Schema of the products:

    
    add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
    	$yasr_rating = get_post_meta(get_queried_object_id(), 'yasr_overall_rating', true);
    	if( $yasr_rating ) {
    		$entity['reviewRating']['ratingValue'] = $yasr_rating;
    	}
    	var_dump($entity);
    	return $entity;
    });
    

    ​​​​​​​
    You might need to modify this filter further depending on the implementation you have on your website for the current Schema markup and the star rating plugin.

    Don’t hesitate to get in touch if you have any other questions.

    Thank you for your great support, I’m not good at programming, but I’ll add this code to the theme, can I contact you if there’s a problem?

    I think I should enter this code in the functions.php and then try to test the code with the Google console in rankmarh, right?

    Hello,

    Sure, you can use the filter and let us know how this goes. The filter should go to your active theme’s functions.php file.

    Once done, you can test the URL using Google’s Rich Results test tool.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘EDD product rating in schema’ is closed to new replies.