Support

Account

Home Forums General Issues Review system with ACF

Solving

Review system with ACF

  • Hi,

    I am trying to build a review system using ACF.

    Reviews (custom post type) is attached to a Product (custom post type). A review is composed of 4 items (integer). For each review, I’ve created a calculated field : (item 1 + item 2 + item 3 + item 4) / 4 = customer rating.

    That works well.

    Now, I am trying to display (using a shortcode) the global average rating that would consist of : (customer rating 1 + custom rating 2 + … + customer rating n) / n

    Any idea on how to achieve this ?

    Thanks

  • Did you ever figure this out? I’m trying to do the same thing.

    • binny

    • June 30, 2020 at 3:19 am

    One way is to set a field called avg rating that can hold num of reviews and total score on the post that the reviews are attached to and whenever a new review is approved to hook into it with acf/save_post (https://www.advancedcustomfields.com/resources/acf-save_post/)
    and update the field of the main post with the new values adding +1 to total and +customer rating to the total score.
    then on shortcode just do the simple total/num_reviews

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.