Bug in Products (grid or carousel)
-
Hi there,
I’m using “Products (grid or carousel)” element to display products from a certain category (ex. Racquets) and a certain brand (ex. Wilson). But When I chose the two taxonomies, it doesn’t pull the right products based on them. In case of my examples, I don’t get Wilson racquets when I choose the category of “racquets” and the “Wilson” brand.
Thanks
Sorry, I really need this feature, would you think it can be solved? Or I need to think of other solutions?
Thanks,
Hi,
We tested this function on our development website and it works correctly. Could you please provide us a page where you added it and your admin access so we can check it?
Thank you
Thanks for your reply,
Actually it’s a logical issue, if you choose multiple taxonomies, by default, it combines them using “OR”, which is not always helpful. As for my example, I want to show products that belong to a specific category (Racquets) “AND” a specific brand (Wilson).
Thanks
You can edit the file woodmart/inc/shortcodes/products.php
and change this line
if( count( $terms ) > 1 ) $args['tax_query']['categories'] = array( 'relation' => 'OR' );
to this
if( count( $terms ) > 1 ) $args['tax_query']['categories'] = array( 'relation' => 'AND' );
Thanks a lot, it worked like a charm.
By the way, that would be great if we could have a feature in your future updates to define logical operators for taxonomies.
Many thanks,
We will consider adding some options for this in the future.