Title: AND Operator not working
Last modified: September 28, 2018

---

# AND Operator not working

 *  Resolved [elspearo](https://wordpress.org/support/users/elspearo/)
 * (@elspearo)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/and-operator-not-working/)
 * Hi there
 * Absolutely great plugin, really fast and easy to use.
 * I have a problem in that I can’t get the filters to use the AND operator and 
   filter down when multiple filters are selected.
 * If two or more subcategories are selected I want the filters to only show products
   that make X filter AND Y filters not OR.
 * I tried using this function in my functions.php file but it didn’t work:
 * [https://www.woocommerce-filter.com/hook/woof_main_query_tax_relations/?content_only=1](https://www.woocommerce-filter.com/hook/woof_main_query_tax_relations/?content_only=1)
 * PLease assist. I have decided to start a new thread as I haven’t received a response
   on another thread I commented on.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fand-operator-not-working%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [pavloborysenko](https://wordpress.org/support/users/pavloborysenko/)
 * (@pavloborysenko)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-10732720)
 * Hello
 * Please drop me the code that you added
 * In file – \plugins\woocommerce-products-filter\index.php comment this line – 
   [https://c2n.me/3WYgE3x.png](https://c2n.me/3WYgE3x.png)
 *  Thread Starter [elspearo](https://wordpress.org/support/users/elspearo/)
 * (@elspearo)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-10736475)
 * Thank you, when I commented the line as you suggested it works now.
 * Do I need to add anything else to my functions.php so that it will continue to
   work if I update the plugin and overwrite the comment?
 *  [pavloborysenko](https://wordpress.org/support/users/pavloborysenko/)
 * (@pavloborysenko)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-10738985)
 * Hello
 * No! In the new version this line will be commented
 *  [greenlyst](https://wordpress.org/support/users/greenlyst/)
 * (@greenlyst)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-10755443)
 * Hi [@pavloborysenko](https://wordpress.org/support/users/pavloborysenko/),
 * I got a similar problem and tried the above approach, but it is not leading to
   the desired behavior.
 * Steps taken:
 * – added the snippet to the WP Astra Theme (tried both the parent and child theme’s
   functions.php)
    – commented the line in \plugins\woocommerce-products-filter\
   index.php (as hinted above)
 * When commenting the line the filter jumps from a product category archive to 
   the generic product archive. I would instead like to have the filter relation
   AND applied only within the current level of detail (product category archive).
 * Looking forward for your input on this!
    -  This reply was modified 7 years, 7 months ago by [greenlyst](https://wordpress.org/support/users/greenlyst/).
 *  [pavloborysenko](https://wordpress.org/support/users/pavloborysenko/)
 * (@pavloborysenko)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-10767884)
 * Hello [@greenlyst](https://wordpress.org/support/users/greenlyst/)
 * Try this in plugin settings->Advanced->Options – [https://c2n.me/3XdOaia.png](https://c2n.me/3XdOaia.png)
 *  [alejor](https://wordpress.org/support/users/alejor/)
 * (@alejor)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-11114972)
 * Hi,
    After the last update, the AND operator stopped working. The operator was
   configured through the woof_main_query_tax_relations filter. I would appreciate
   the help you can give me.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘AND Operator not working’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-products-filter/assets/icon-256x256.png?rev=
   2844301)
 * [HUSKY - Products Filter Professional for WooCommerce](https://wordpress.org/plugins/woocommerce-products-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-products-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-products-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-products-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-products-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-products-filter/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [logic](https://wordpress.org/support/topic-tag/logic/)

 * 6 replies
 * 4 participants
 * Last reply from: [alejor](https://wordpress.org/support/users/alejor/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/and-operator-not-working/#post-11114972)
 * Status: resolved