Metafield-based customer segment filters

If you created a customer metafield definition, then the metafield can be used as a filter. Customer segments can only be created from metafields that use the following data types:

  • date and time
  • number
  • text
  • true or false

Learn more about Metafields.

If you're a developer, then you can refer to the Metafields developer documentation.

OperatorsThe operators that are available depend on which content type is used for the metafield.

Date and time:<br>
    <br>
    <ul>
      <li>In the last 7 days: <code translate="no">&gt;= 7_days_ago</code></li>
      <li>In the last 30 days: <code translate="no">&gt;= 30_days_ago</code></li>
      <li>In the last 90 days: <code translate="no">&gt;= 90_days_ago</code></li>
      <li>In the last 12 months: <code translate="no">&gt;= 12_months_ago</code></li>
      <li>Exactly on date: <code translate="no">=</code></li>
      <li>On or before date: <code translate="no">&lt;=</code></li>
      <li>On or after date: <code translate="no">&gt;=</code></li>
      <li>Between dates: <code translate="no">BETWEEN &lt;date1&gt; AND &lt;date2&gt;</code></li>
    </ul>

    Number:<br>
    <br>
    <ul>
      <li>Is equal to: <code translate="no">=</code></li>
      <li>Is not equal to: <code translate="no">!=</code></li>
      <li>Greater than: <code translate="no">&gt;</code></li>
      <li>Smaller than: <code translate="no">&lt;</code></li>
      <li>Smaller or equal to: <code translate="no">&lt;=</code></li>
      <li>Greater or equal to: <code translate="no">&gt;=</code></li>
      <li>Between: <code translate="no">BETWEEN</code></li>
    </ul>

    Number with list of values:<br>
    <br>
    <ul>
      <li>Contains: <code translate="no">CONTAINS</code></li>
      <li>Doesn't contain: <code translate="no">NOT CONTAINS</code></li>
    </ul>

    Text:<br>
    <br>
    <ul>
      <li>Is equal to: <code translate="no">=</code></li>
      <li>Is not equal to: <code translate="no">!=</code></li>
    </ul>

    Text with list of values:<br>
    <br>
    <ul>
      <li>Contains: <code translate="no">CONTAINS</code></li>
      <li>Doesn't contain: <code translate="no">NOT CONTAINS</code></li>
    </ul>

    True or false:<br>
    <br>
    <ul>
      <li>Is equal to: <code translate="no">=</code></li>
      <li>Is not equal to: <code translate="no">!=</code></li>
    </ul>

    Exists or doesn't exist:<br>
    <br>
    <ul>
      <li>Doesn't exist: <code translate="no">IS NULL</code></li>
      <li>Exists: <code translate="no">IS NOT NULL</code></li>
    </ul>
  </td>
</tr>
<tr>
  <th>Values</th>
  <td>The values that are available, if any, depend on whether values were added to the metafield or whether you use
    third-party apps to pull data into your metafields. You might need to enter values manually.
  </td>
</tr>
<tr>
  <th>Format</th>
  <td>The format of the data that is entered depends on what was set up in the metafield.
  </td>
</tr>
<tr>
  <th>Example</th>
  <td>
    <p>Points balance example:<br>
      <code translate="no">customer.points_balance &gt;= 100</code>
    </p>
  </td>
</tr>
<tr>
  <th>Notes</th>
  <td>
    <ul>
      <li>The filter name is based on the name of the metafield. The code is based on the <a
          href="/manual/custom-data/metafields/metafield-definitions/metafield-definition-parts">namespace and the key</a> of
        the metafield.</li>
      <li>Some common use cases for using Metafields for a customer segment include point balances, loyalty and
        rewards, and customer birthdays.</li>
    </ul>
  </td>
</tr>


Can’t find the answers you’re looking for? We’re here to help.