如何在 woocommerce 中获得 API 中的畅销产品和收藏夹产品?

How to get bestselling and favorites products in rest API in woocommerce?

我想从 woocommerce 网站获取畅销和最喜欢的产品 API 。

我读了 this site 但没有找到任何相关信息。

有没有办法得到它?

我看到您可以通过报告访问畅销书。 See here. As for favourites, I think this is done using third party plugins or custom code so I'm not sure how you are going to access this. But if I was to hazard a guess I would probably assume it would be under customer meta

对于仍然被这个问题绊倒的人

根据 WC v3 API。您现在可以通过 API(根据我的理解,这是最畅销的产品列表)提取最流行的产品;

GET /wp-json/wc/v3/products?orderby=popularity&order=desc

这应该会为您提供按销量降序排列的最受欢迎的产品。 This is not currently documented(截至 2021 年 2 月 2 日)。

可能的 orderby 参数的总列表是:dateidincludetitleslugmodifiedmenu_orderpricepopularityrating

问题的另一部分要求 Favorite 产品 API,woo commerce 没有。