Is there a way to only fetch categories that have been assigned to a minimum of entries, i.e. 4
?
Currently I fetch categories like this:
{% set productIds = craft.entries.section('products').ids() %}
{% set categories = craft.categories.relatedTo({ sourceElement: productIds }) %}
I know I can now do the following to only display content for categories which have been assigned to at least four entries:
{% set entries = craft.entries.section('products').relatedTo(category) %}
{% if entries|length > 4 %}
...
{% endif %}
But is there a way to apply this logic to the craft.categories
query?