Hey everyone!
I want to set a condition to a div to show or hide based on if at least one featured product is exist. Also want to the the same but for promotions.
So the logic should be something like:
- If at least 1 featured product exist = render the selected div.
- If at least 1 product with promotion exist = render the selected div.
Is there anyone who had similar issue and managed to resolve it?
Appreciate any help!
Hi @simotamas7
If you’re using a Query Loop to display your products, you can use {query_results_count:xxxxxx} - xxxxxx being the ID for the Query Loop Element - as a Dynamic Tag to validate the number of results found:

Condition:

1 Like
@frussane Thank you for the answer!
Sadly I’m using the products element provided by bricks.

Any idea how can this be achieved with the products element?
If not I will probably make my own query as you mentioned.
I might be wrong, but AFAIK on that case you’ll probably have to get a PHP custom function to return true/false on those query results, in order to make it conditionally visible 
Since the Query Loop provides an easy way to query both On Sale and Featured Products, I think you’d be better off this way!
Query Loop Woocomerce options when Products post type selected:

1 Like
You are right, thank you so much for your help!
1 Like