I'm using Woocomerce for my wordpress shopping cart. I'm connect my Android App to my Wordpress database through Woocommerce REST API. I need to get products by category on my App. There is no provision in the REST API to fetch product by category.
I tried by using the filter attribute:
https://example.com/wc-api/v1/products?filter[product_cat]=gedgets&consumer_key=ck_9354534x&consumer_secret=cs_dx7345345
This is return me all the products.
Go to: WooCommerce > Settings > Advanced > REST API. Note: Keys/Apps was found at WooCommerce > Settings > API > Key/Apps prior to WooCommerce 3.4. Select Add Key. You are taken to the Key Details screen. Add a Description.
To fetch all products in a certain category, you will want to use the products API with the category parameter: Replace ID with the ID of your category. This is in the documentation here:
There is no provision in the REST API to fetch product by category. I tried by using the filter attribute: This is return me all the products. Show activity on this post. In this case you should use the filters... however, It worked for me : the 16 is a sample of category id... Show activity on this post.
In this case you should use the filters...
however, It worked for me :
http://www.example.com/wp-json/wc/v1/products?category=16
the 16 is a sample of category id...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With