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:

  • In the last 7 days: >= 7_days_ago
  • In the last 30 days: >= 30_days_ago
  • In the last 90 days: >= 90_days_ago
  • In the last 12 months: >= 12_months_ago
  • Exactly on date: =
  • On or before date: <=
  • On or after date: >=
  • Between dates: BETWEEN <date1> AND <date2>
Number:

  • Is equal to: =
  • Is not equal to: !=
  • Greater than: >
  • Smaller than: <
  • Smaller or equal to: <=
  • Greater or equal to: >=
  • Between: BETWEEN
Number with list of values:

  • Contains: CONTAINS
  • Doesn't contain: NOT CONTAINS
Text:

  • Is equal to: =
  • Is not equal to: !=
Text with list of values:

  • Contains: CONTAINS
  • Doesn't contain: NOT CONTAINS
True or false:

  • Is equal to: =
  • Is not equal to: !=
Exists or doesn't exist:

  • Doesn't exist: IS NULL
  • Exists: IS NOT NULL
ValuesThe 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.
FormatThe format of the data that is entered depends on what was set up in the metafield.
Example

Points balance example:
customer.points_balance >= 100

Notes
  • The filter name is based on the name of the metafield. The code is based on the namespace and the key of the metafield.
  • Some common use cases for using Metafields for a customer segment include point balances, loyalty and rewards, and customer birthdays.
Can’t find the answers you’re looking for? We’re here to help.