WAIT: Search Filter Ignores {query_results_count} unless it's a page reload

  • I created a query loop Block Z that fetches woocommerce products.

  • Post > Products and infinite scroll etc… works.

  • For Block A outside the query loop I’ve added a condition using {query_results_count:fd7aa1} - this will show the block if the query is != 0

  • Block A also has a CHECKBOX filter Works

  • Block B has a SEARCH filter Works

  • Here is the thing though… if I search for products and results are ZERO - Block A does not disappear, BUT if I do a page refresh with the url holding the empty search ie _search=asdadasd then Block A will be hidden on the new page load. Is this a bug? If I use the search filter and results are ZERO how can I hide Block A?

  • Continue from above if search=asdadasd results are empty and I delete what’s in the search field, empty search, then the products are shown (updated), but Block B remains hidden, BUT then if I do a page refresh, then block B is NOT hidden.

Hello @dailce,

I think the most important thing to know here is to keep in mind that the conditions will only be executed on page load. So if the query is empty on page load, well, this is what the conditions will compare to.

We also have {query_results_count_filter:queryId} filter, that will output the number of results dynamically. But, you can’t rely on this one in conditions, as conditions only run on page load.

We do have interactions when Filter elements themselves are empty (Query Sort, Filter & Live Search – Bricks Academy), but I guess this will not help in you case, right?

Overall, I’m not sure if you can do what you need with the current functionality.

Best regards,
Matej

1 Like