'Elementor custom query filter best seller and best rated

I have a platform for multi instructors, and I want to add two sections using Elementor for the best-selling courses (courses that got a lot of purchases) and best rated (courses that got a high rating). each one has its own section (query), not together.

How can I make the custom query filter, and where do I add the custom query in which file?

Because I only have queries filter for last updated, date, comment, and ID.

I am using WordPress, Elementor, Tutor LMS, and WooCommerce.

I saw this: https://developers.elementor.com/docs/hooks/custom-query-filter/

but I don't know how to do it for the best-selling and best rated and where I put the codes.

Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source