problum在REST API中按类别获取woocommerce产品

problum在REST API中按类别获取woocommerce产品

问题描述:

您好,我正在使用woocommerce REST API的REST API, 我想按类别获得产品。当我通过这个URL我得到了所有的产品。problum在REST API中按类别获取woocommerce产品

https://www.ezdarshan.com/wc-api/v2/products/?consumer_key=ck_dbf0f35e37dc0xxxxxxxxxxxb31d2&consumer_secret=cs_ea299e9b86xxxxxxxxxxxxxxf785a9f77ec7 

但是当我使用过滤器是这样的:类= 56,37

,我再次得到了所有的产品,但我想这只是涉及这些类别的产品

我按照这个文档:https://woothemes.github.io/woocommerce-rest-api-docs/?php#list-all-products

有人帮我

+0

请:什么版本[** WooCommerce REST API **](http://woothemes.github.io/woocommerce- rest-api-docs /)?...有4种可能的版本...请尽可能更新您的问题,以便有机会获得帮助。 – LoicTheAztec

我刚刚解决了类似的问题。使用slug代替id /名称。它为我工作。

https://yourwebsite.com/api/user/proxy/products/?filter[category]=<SLUG OF CATAGORY> 

正确:(注意尾随斜线被删除)

https://yourwebsite.com/api/user/proxy/products?filter[category]=<SLUG OF CATAGORY> 
+0

你确定这是woocommerce api吗?你能参考文档吗? –