Skip to content

Instantly share code, notes, and snippets.

@mdcpepper
Created March 13, 2014 15:22
Show Gist options
  • Save mdcpepper/9530482 to your computer and use it in GitHub Desktop.
Save mdcpepper/9530482 to your computer and use it in GitHub Desktop.
{% set excludedIds = [] %}
{% set allProducts = craft.entries.section('products') %}
{% for product in allProducts %}
{% if product.productCategories|length %}
{% set excludedIds = excludedIds|merge(['not '~product.id]) %}
{% endif %}
{% endfor %}
{% set products = craft.entries.section('products').id(excludedIds).limit(null) %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment