How to set condition after query loop

Hi everyone,
I’m trying to set up a condition where only products with a price are displayed, while hiding those without a price. Here’s my current setup:

  • I’m using a query loop on the product container (e.g., a “product box”).

  • If I add a condition to an inner box containing product elements (e.g., title, price, image), the condition works, but it leaves an empty space between products when elements are hidden.

  • If I apply the condition directly to the query loop (to filter products upfront), it hides products without prices correctly, but the result is an empty shop page (no products show up at all).

I also tried assigning the query loop to a parent container holding all products, but this caused issues with filters (though I haven’t tested this thoroughly yet).

Is there a way to hide products without prices without leaving empty spaces or breaking the query loop? Am I applying the condition incorrectly?