The next article in this series of WooCommerce tutorials I will show you how to display highly rated products in WooCommerce. That means I will display the list of products sorted by the rating term (stars) in WooCommerce.
Product evaluation feature of WooCommerce
WooCommerce plugin Provide us with the function of product review (review). This function allows us to leave comments about the product, and evaluate it star for products (The highest is 5 stars).
To turn on this function, go to: Wp-admin -> WooCommerce -> Establish -> Products -> Moving bottom subsidence, (The default is oke most, but if you want to customize the requirements, you can customize)
Product configuration is evaluated in admin
Product review form with star rating
Display the WooCommerce highly rated product list
To display the list of products sorted by rating, use the following code
10, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => '_wc_average_rating', 'orderby' => 'meta_value_num', 'order' => 'DESC', );?> in_the_loop = true; ?> have_posts()) : $getposts->the_post(); ?> get_rating_count(); $review_count = $product->get_review_count(); $average = $product->get_average_rating(); ?>
The above code get 10 products from high to low rating. Products with a higher star rating will show first then products with fewer stars and finally products that are okay.
The above code also shows the number of stars I have evaluated. The reference you can customize accordingly.
Today I have shown you how to get a list of highly appreciated products, hope this article will help you in the process of learning wordpress theme programming. I continue to publish articles about the subject of WooCommerce so you should pay attention to it!
If you have any questions or comments for the article, please comment below, I would be happy to receive and absorb
The post Show rated products in WooCommerce appeared first on Blog Huy Kira.Read more :
- Schema Premium v1.1.3 - WordPress structured data plugin
- Fundstrat: Bitcoin has entered the bull market, potentially rising to $ 15k
- Themify Event v2.1.4 - Responsive Theme For Bands, Nightclubs, Restaurants, Bars ...
- Kuinka asentaa Disqus - kommentti Bloggeriin - Wonder Krish | Blogger | SEO
- C drive is full, the instructions on how to fix!