I have tried this one for example:
$query = new WP_Query( array( 'tag__and' => array( 37, 47 ) ) );
It doesn't seem to work. Am I wrong in thinking that category and tags are the same relative to the database eg. in the wp_terms table. Both Categories and Tags show up in there.
So I'm looking in wp_term_relationships and I see an object_id for the product that I want, it has the following example term_taxonomy_id's: 48, 45, 43, 38, 37, 33, 24, 23, 15, 8
So in my filter I want to return the product(s) that have all of those tags.
The query above seems to be like a partial(returns products that have some of those tags), I noticed there is also tag__in.
What am I doing wrong?
I don't really get the taxonomy type search, do I have to explicitly state a taxonomy like in the dashboard? I was trying to do this with just "straight SQL" too, I tried the IN operator with a comma separated tag int list in parenthesis and a DISTINCT select... it's ugly, I mean it works but I'm using a combination of SQL and PHP to do the sorting. There's also no pagination/offset so yeah I'm trying to improve this.
This is an off-hand question but I'm also wondering if this is built into WooCommerce by default. That is what this question pertains to but it is specifically about sorting. But I was wondering, I saw there is woocommerce_pagination or is it woo_pagination, but not sure if it just "works out of the box" eg. filter search, pagination with limits/sorting.
Thanks for any help, I'll keep searching/trying stuff.
tax_query
.tag__and
will not query categories.