Order by Rating not working
-
Hi,
On the category pages we are unable to order by average rating. Ordering by price is working fine, but as soon as we order by rating a seemingly random sort order is displayed.
The product rating of each product is imported from another site using the WooCommerce API and is in the wp_postmeta table with the meta_key ‘_wc_average_rating’. The rating is displayed correctly on each product page.
I tried disableing most plugins but WooCommerce and Woodmart core, but this does not change anything.
Is there anything else I can try?
Thanks!
Attachments:
You must be
logged in to view attached files.
Hello,
Could you please check how it works with some default WordPress themes like WooCommerce Storefront to understand if it is our theme issue or not?
Kind Regards
Hi Luke,
When switching to one of the default themes the same problem occurs. So it seems to be a problem not related to Woodmart.
In the meantime I found the problem: apparently WooCommerce is not ordering by the _wc_average_rating in the wp_postmeta table. Instead it is using the wp_wc_product_meta_lookup. By adding product ratings to that table everything was in the correct order.
Thanks for your help.
Hello,
Great! Glad that you have solved the issue.
Let me know if you have any questions or if the topic can be closed. Have a good day!
Kind Regards