I don’t know if I understand
Can I change to “AND”? Is possible? Can you help me?
Sorry, I saw these text you sent me. I think I understood, thank you! 🙂
I’ll try it.
I tried to add this code in my theme functions.php, but it didn’t work 🙁
(first link you sent me)
I would like my plugin work with “AND” for filter in “category” and “tag” too.
add_filter(‘woof_products_query’, ‘my_woof_products_query’);
function my_woof_products_query($query)
{
$relations = array(
‘product_cat’ => ‘AND’
);
if (!empty($query[‘tax_query’]))
{
foreach ($query[‘tax_query’] as $key => $value)
{
if (in_array($value[‘taxonomy’], array_keys($relations)))
{
$query[‘tax_query’][$key][‘operator’] = $relations[$value[‘taxonomy’]];
}
}
}
return $query;
}
Hello
This works for shortcodes [woof_products] only and not with native (while) woo API. How did you made test? I mean drop me here shortcodes you tried …
Sorry the delay, I have been tried something but I didn’t get sucess.
My test website is http://busqueseupersonal.com.br/cadastro-provisorio/
And in my widget, I tried to use in “Plugin | WooCommerce”, the sortcode [woof]. And I used “WooCommerce Products Filter”, nothing =(
Hello
For this 2 weeks I did some code changes for native woocommerce request, so download index.php http://www.woocommerce-filter.com/wp-content/uploads/2016/06/index-1.1.4.4.zip of the plugin and replace it in the plugin folder by ftp, then in functions.php of your wp theme use next code:
add_filter('woof_main_query_tax_relations', 'my_woof_main_query_tax_relations');
function my_woof_main_query_tax_relations()
{
return array(
'product_cat' => 'AND'
);
}
Oh, I see!!
Thank you for your attention, now it is working! 😀