woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.42k stars 10.77k forks source link

Filter Product List by Mutiple attribute and its attribute terms in Woocommerce Rest API #27370

Open Lalitchaudhary2 opened 4 years ago

Lalitchaudhary2 commented 4 years ago

i am developing mobile application to connect WooCommerce wordpress V3 rest API in iOS and Android.

i am getting the product list from Rest API

"wp-json/wc/v3/products"

i am able to filter product using

"wp-json/wc/v3/productscategory=241&attribute=pa_flavor&attribute_term=301"

and filter multiple attribute term using

"wp-json/wc/v3/products?attribute=pa_flavor&attribute_term=301,302,305".

i need to filter product with multiple attribute(like pa_flavor,pa_size,pa_color... etc.) in rest API. how can do that?

issue-label-bot[bot] commented 4 years ago

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

juliaamosova commented 4 years ago

Hi @Lalitchaudhary2,

Thank you for posting your question here!

Filtering products by multiple attributes is currently not supported by v3 of the WC REST API. You are welcome to submit a PR for this feature to be included in v4 if you like/can.

In the meantime, I will mark this issue as an enhancement.

sublimit14 commented 6 months ago

@juliaamosova Hi, can I use multi-attribute filtering now?

I'm developing an application in React that uses woocommerce as a handleless cms.

The request that does not work correctly for me looks like this:

https://example.com/wp-json/wc/v3/products/?pa_color=156,158&pa_brand=157,159,160