1. cliveportman
  2. /code
  3. /fetch-entries-with-an-empty-field-using-craft-cms

Fetch entries with an empty field using Craft CMS or Craft Commerce

This works with a custom field that is a checkbox and fetches only entries where that checkbox is not checked.

{% set products = craft.commerce.products({
 customField: ':empty:',
 hasVariant: {
    hasStock: true
 },
  type: 'class',
 limit: 5
}) %}