0

hello i am using REST API of woocommerce REST API , i want to get product by category . when i pass this url i got all product .

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

But when i use filter like this : ?category=56,37

Again i got all product but i want only product which related to these category

i Follow this docs : https://woothemes.github.io/woocommerce-rest-api-docs/?php#list-all-products

Some on help me

  • Kindly: What version for [**WooCommerce Rest API**](http://woothemes.github.io/woocommerce-rest-api-docs/)?… There is 4 possible versions… Please update your question with much more details as you can, to have a chance to get helped. – LoicTheAztec Jul 16 '16 at 11:07

2 Answers2

2

I just resolved similar issue. Use slug instead of id / name. It worked for me.

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

Correct: (note the trailing slash is removed)

 https://yourwebsite.com/api/user/proxy/products?filter[category]=<SLUG OF CATAGORY>
Cameron Hurd
  • 4,836
  • 1
  • 22
  • 31
0

This might be little late to answer but might be helpful for others

According to the new wordpress REST API version this worked for me

https://www.xxxx.com/wp-json/wc/v3/products?category=categoryid

Ankit Prajapati
  • 417
  • 1
  • 8
  • 20