wp-graphql-woocommerce
wp-graphql-woocommerce copied to clipboard
Multiple Taxonomy Query
Is your feature request related to a problem? Please describe. Currently the wp-graphql-woocommerce plugin only supports finding products by a single taxonomy.
Describe the solution you'd like A clear and concise description of what you want to happen.
Currently you can only search products on a single taxonomy as follows:
query MyQuery {
products(where: {categoryIn: "womens", taxonomyFilter: {or: {taxonomy: PACOUNTRY, terms:"USA"}}}) {
edges {
node {
name
}
}
}
}
Describe alternatives you've considered Would like to search multiple taxonomies with an array:
query MyQuery {
products(where: {categoryIn: "womens", taxonomyFilter: {or: [{taxonomy: PACOUNTRY, terms:"USA"}, {taxonomy: PAFRAMECOLOR, terms:"Black"}] }}) {
edges {
node {
name
}
}
}
}
@thatONEjustin Your query actually is supported, and should 100% work, however there seems to be a bug when using multiple entries in the and
or or
fields.
I have also faced this bug. Seems that taxonomyFilter with OR queries with AND operator instead.
Could you pls inform if this bug is going to be fixed in the nearest future?
it's kinda related would really help to get some help here:
query Products($first: Int!, $after: String, $categories: [String]) { products( first: $first after: $after where: {status: "PUBLISH", taxonomyFilter: {filters: {taxonomy: PRODUCT_CAT, operator: AND, terms: $categories}}} ) { pageInfo { hasNextPage endCursor } edges { node { databaseId } } } }
why this doesnt work when i add more than one elem in the categories array? this is working: { "categories": ["foo"], "first": 100 } this is not working: { "categories": ["foo","bar"], "first": 100 } how do i get over this?