Sabuj Kundu 28th Mar 2019

We have Multi criteria Rating plugin, we have another one called Single Criteria Rating Plugin for near same purpose with near same feature with some exception. I was thinking and looking to replace woocommerce’s native rating with our developed one. Woocommerce native rating is simple and it uses wordpress’s comment system to store data and custom taxonomy for storing 1-5 star tag for product which name is “product_visibility”. After looking into deep into woocommerce code I found it’s possible and I really did with both of our Rating plugin. Here are the things I needed to take care or look to handle this job

  • Need our own rating system that supports woocommerce product post type
  • Woocommerce uses comment table to store rating
  • Woocommerce uses taxonomy to store 1-5 star rating count tagged term for products. That means for taxonomy “product_visibility” they have 5 terms like “rated-5, rated-4, rated-3, rated-2, rated-1”
  • Woocommerce has a most rated products widgets
  • Woocommerce has a widget to filter products by rating score
  • In shop page or product listing page woocommerce has option to filter by rating avg
  • In product details woocommerce shows avg, has a tab Reviews which which shows review count, review form and review listing
  • In product listing woocommerce shows rating star after title
  • Woocommerce has Query builder api which later uses wordpress’s builtin query builder. So needs to hook that.

So to accomplish our target, we can ignore what woocommerce has in core but doesn’t conflict, example widget, taxonomy or terms. We can create our own widget and own technique to store rating data. I have created my own rating system which stores the rating and rating avg into custom tables plus always stores the rating count and avg rate into post meta table for any post types for easy query later or for situation like this. This rating and review system has every simple to advance features it should have(suppose).

Adjust Product Sorting order by Rating Avg

Adjust Product Sorting order by Rating Avg

Please note that, I requested a simple change and sent pull request to woocommerce’s github repo and they accepted it. To replace the woocommerce’s native review and rating with our plugin I needed to hook into woocommerce’s code using the existing filters (actions and filters) and found that that can be achieve easily if one filter named “woocommerce_get_catalog_ordering_args” has more params (though I implemented without this pull request was accepted and not sure if that is released with core plugin yet)