M
M
Mkulya2020-10-26 12:35:49
WooCommerce
Mkulya, 2020-10-26 12:35:49

How to get all product ratings individually in Woocommerce?

Hello!

There is a task to make progress bars 5f96982cb5a47478325936.jpegwith estimates, tell me how you can get the necessary data?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2020-10-26
@Mkulya

You receive reviews / they are also comments
The rating is stored in the comment in an arbitrary 'rating' field

$user_rate = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) )

Go through the comments loop, and in the control array, the key of the element in which the value of the assessment will be, plus the assessment in the corresponding elements.
at the output, get an array in which the keys are the value of the assessment and the values ​​are the number of these values.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question